Skip to content
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

[web-animations-2] [scroll-animations] usage of timeline range offsets in the Web Animations API #11467

Open
graouts opened this issue Jan 9, 2025 · 4 comments

Comments

@graouts
Copy link
Contributor

graouts commented Jan 9, 2025

The Scroll-driven Animations specification defines Named Timeline Range Keyframe Selectors allowing specific portions of a scrollable area to be targeted while rendering animations. Specifically, the combination of a <timeline-range-name> and a <length-percentage> such as cover 10%.

The Scroll-driven Animations specification discusses this only within the context of CSS-declared @keyframes rules, but the Web Animations specification does not discuss how such values can be used through the Web Animations API and the various methods it defines to consume keyframes: animate(), setKeyframes() and the KeyframeEffect constructor. It doesn't discuss either how such keyframe offsets would be dealt with in a call to getKeyframes().

There are a fair few WPT tests related to this, too many to list here, so the Chrome team has given this some thinking and WebKit will be getting support for this in short order, but this entire area needs to be specified and the merits and the approach taken by the Chrome team need to be discussed.

@graouts graouts added web-animations-2 Current Work scroll-animations-1 Current Work labels Jan 9, 2025
@graouts
Copy link
Contributor Author

graouts commented Jan 9, 2025

Cc @flackr, @andruud, @kevers-google and @bramus.

@flackr
Copy link
Contributor

flackr commented Jan 9, 2025

In the Web Animations spec, ranges can be used by rangeStart and rangeEnd properties on the animation options (discussed in #7589), and #10000 is proposing supporting them for keyframe offsets as well. These are represented as a TimelineRangeOffset when returned and we would presumably do the same for offsets.

@graouts graouts added the Agenda+ label Jan 9, 2025
@graouts
Copy link
Contributor Author

graouts commented Jan 9, 2025

Yes, that is what Chrome implements and it sounds reasonable. We need updates to the spec to specify expanded variants in the IDL for the various dictionaries and the minutiae of how to represent unresolved computed offsets (Chrome uses NaN) and the relative sorting of keyframes with null, double and TimelineRangeOffset specified offsets.

@flackr
Copy link
Contributor

flackr commented Jan 9, 2025

FYI for sorting of keyframes, see #8507.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants