[css-houdini-drafts] [css-animationworklet] Retrieve computed data (ie velocity) from AnimationWorklet (#976)

InventingWithMonster has just created a new issue for https://github.com/w3c/css-houdini-drafts:

== [css-animationworklet] Retrieve computed data (ie velocity) from AnimationWorklet ==
In the AnimationWorklet spec there's a [spring example](https://drafts.css-houdini.org/css-animationworklet-1/#example-1). 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](https://github.com/Popmotion/popmotion/blob/master/packages/popmotion/src/animations/spring/index.ts) or [inertia](https://github.com/Popmotion/popmotion/blob/master/packages/popmotion/src/animations/inertia/index.ts) 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.

Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/976 using your GitHub account

Received on Friday, 17 January 2020 13:16:07 UTC