Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow missing end values for integer animations #2487

Merged
merged 1 commit into from Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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