Skip to content

Commit

Permalink
Allow missing end values for integer animations (#2487)
Browse files Browse the repository at this point in the history
Fixes #2480
  • Loading branch information
gpeal committed Apr 1, 2024
1 parent 6c6e5ff commit 4e1c3dc
Show file tree
Hide file tree
Showing 2 changed files with 14,073 additions and 3 deletions.
Expand Up @@ -20,21 +20,23 @@ Integer getValue(Keyframe<Integer> keyframe, float keyframeProgress) {
* Optimization to avoid autoboxing.
*/
int getIntValue(Keyframe<Integer> keyframe, float keyframeProgress) {
if (keyframe.startValue == null || keyframe.endValue == null) {
if (keyframe.startValue == null) {
throw new IllegalStateException("Missing values for keyframe.");
}

int endValue = keyframe.endValue == null ? keyframe.getStartValueInt() : keyframe.getEndValueInt();

if (valueCallback != null) {
//noinspection ConstantConditions
Integer value = valueCallback.getValueInternal(keyframe.startFrame, keyframe.endFrame,
keyframe.startValue, keyframe.endValue,
keyframe.startValue, endValue,
keyframeProgress, getLinearCurrentKeyframeProgress(), getProgress());
if (value != null) {
return value;
}
}

return MiscUtils.lerp(keyframe.getStartValueInt(), keyframe.getEndValueInt(), keyframeProgress);
return MiscUtils.lerp(keyframe.getStartValueInt(), endValue, keyframeProgress);
}

/**
Expand Down

0 comments on commit 4e1c3dc

Please sign in to comment.