Animate value property rather than offset #9302
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Type of Change
Why
In the RN Animated API, the offset value should not change unless explicitly set by the user (or extract offset / flatten offset is called on the value node). In the previous composition implementation for NativeAnimated, the offset property in the CompositionPropertySet was animated, meaning if the user specified an offset value, its initial value was assumed to be zero for the spring and decay drivers, and more problematically, the animation needed to implicitly flatten the offset at the end of the animation.
Resolves #9256
What
This change keeps a fixed offset during animations and instead animates the raw value.
Testing
RNTester animations still behave correctly:
React.Native.Playground.Win32.2021-12-20.12-43-07.mp4
Breaking Change
This is marked as a breaking change, but only if people have relied on buggy behavior where the offset value is implicitly flattened at the end of an animation. Since this is not how animations are supposed to behave on other platforms, the fact that this is "breaking" can probably be ignored by most, but it may still be useful to call out the change in release notes.
Microsoft Reviewers: Open in CodeFlow