-
Notifications
You must be signed in to change notification settings - Fork 756
Description
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:
// cubic-bezier
const curve = Easing.cubicBezier(.17,.67,.83,.67)
const easedProgress = curve(0.5)
// steps
const stepped = Easing.steps(4, "end")
const easedProgress = stepped(0.5)This would also allow the composition of easing functions:
stepped(curve(0.5))And their usage outside of the Web Animations API, for instance drawing visualisations: