w3c / w3c/csswg-drafts

[css-easing-2] Provide JavaScript API for CSS easing functions

Open
#6,261 4 comments 35 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-easing-2
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

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:

Screenshot of Framer's bezier editing tool

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CSS Easing Level 1 specification and compare its specced curves with the proposed JavaScript examples. Define the API shape and requirements for exposing cubic-bezier and steps, including composition and use outside Web Animations. Done requires a resolved proposal or specification direction; no implementation file or test is named.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.