-
Notifications
You must be signed in to change notification settings - Fork 647
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
[css-easing-2] Provide JavaScript API for CSS easing functions #6261
Comments
Maybe inside |
Yep! Not precious over the namespace, gotta make that clear 😀 |
These are probably a good candidate for typed OM, CSS transforms already have something similar in that you can get out a matrix with I'm not entirely sure why there's only a few functions available in typed OM, but it'd make sense to have something like that for easing: const easing = new CSSEasingCubicBezier(CSS.number(.17),CSS.number(.67),CSS.number(.83),CSS.number(.67));
console.log(easing.valueAt(0.5)); |
Because CSS is a big beast, and the design of Typed OM allows for us to define things gradually. ^_^ But yeah, Typed OM definitely needs the easing functions as values at some point, and when we do, having a convenience method that lets you explicitly evaluate it at a given progress value makes a ton of sense. |
With new proposals for complex easing functions, the amount of API surface JavaScript animation libraries are duplicating is to increase.
This is a waste of bundle size when these functions are already present in the browser. This
cubic-bezier
implementation alone can cost 1kb minified, so I'm eager that when new easing curves appear there's already requirement for them to be available to JS authors.It would also ensure browser-based animation authoring tools like Framer could use the current browser's exact implementation when displaying and editing easing curves.
Proposal
A new
Easing
namespace, which contains access to the specced easing curves:This would also allow the composition of easing functions:
And their usage outside of the Web Animations API, for instance drawing visualisations:
The text was updated successfully, but these errors were encountered: