Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[css-animationworklet] Retrieve computed data (ie velocity) from AnimationWorklet #976
In the AnimationWorklet spec there's a spring example. The primary use case for a spring animation is to preserve existing velocity in subsequent animations for natural interactions. In Popmotion we often transfer velocity from a tween or touch gesture into spring or inertia animation.
Currently there's no obvious way of retrieving data like velocity from back out of an AnimationWorklet. Taking the timeline as an abstracted progress value rather than a real progress of time, simply knowing how quickly an animation is moving through this would be enough to figure out real value velocities (if we keep each animation to a single value).
It'd be preferable if we could retrieve velocity back on the main thread as that would allow us to do this calculation between animations. It wouldn't need to be every frame, just when an animation is canceled.