Skip to content

Add Keyframe animation caching #6960

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

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

bartlomiejbloniarz
Copy link
Contributor

@bartlomiejbloniarz bartlomiejbloniarz commented Jan 30, 2025

Summary

Our current implementation of keyframe parsing mutates the keyframe definition object (e.g. we remove the easing function). If we try to call build() on a Keyframe object more than once, we will end up with a different animation after the first time. This is bad because we want people to memoize their Keyframes. I decided to fix this problem by caching the calculated animation. This fixes this problem, and also allows us to reuse the result of parsing.

Test plan

@bartlomiejbloniarz bartlomiejbloniarz added this pull request to the merge queue Jan 31, 2025
Merged via the queue into main with commit 6ac0355 Jan 31, 2025
10 checks passed
@bartlomiejbloniarz bartlomiejbloniarz deleted the @bartlomiejbloniarz/fix-keyframe-easing branch January 31, 2025 08:31
tjzel pushed a commit that referenced this pull request Feb 17, 2025
## Summary

Our current implementation of keyframe parsing mutates the keyframe
definition object (e.g. we remove the easing function). If we try to
call `build()` on a `Keyframe` object more than once, we will end up
with a different animation after the first time. This is bad because we
want people to memoize their Keyframes. I decided to fix this problem by
caching the calculated animation. This fixes this problem, and also
allows us to reuse the result of parsing.

## Test plan
tjzel pushed a commit that referenced this pull request Feb 17, 2025
## Summary

Our current implementation of keyframe parsing mutates the keyframe
definition object (e.g. we remove the easing function). If we try to
call `build()` on a `Keyframe` object more than once, we will end up
with a different animation after the first time. This is bad because we
want people to memoize their Keyframes. I decided to fix this problem by
caching the calculated animation. This fixes this problem, and also
allows us to reuse the result of parsing.

## Test plan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants