You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 7, 2018. It is now read-only.
I propose that animations easings should be able to be specified as functions.
Reason
While cubic-bezier and step provide a good basis for most animations, there are easing functions that cannot be expressed through the existing CSS timing functions. For instance, creating a believable bounce in an animation requires setting easings on multiple keyframes. This is not a good scenario for reusability and doesn't empower developers to innovate in this area.
Also, this would be a good starting point for building more complex animation systems on top of WAAPI.
Here is an issue submitted for CSS that has a lot of ideas on the subject of advanced/complex timings: w3c/csswg-drafts#229
While I personally think JS functions don't belong there, I do think that in the Web Animation API, they would make a lot of sense.
Syntax
Using the keyframe syntax, it would look something like this for a linear function:
element.animate({/* ... */easing: function(offset){// linear functionreturnoffset;}})
Constraints
Since (I think) cubic bezier functions can overshoot 100% progression and undershoot 0% progression, I think it is reasonable that the returned offset should be able to be -Infinity to Infinity. If the function does not return a number, it should throw an error.