Skip to content

[web-animations-2] Custom effects - #14946

Open
graouts wants to merge 1 commit into
w3c:mainfrom
graouts:web-animations-custom-effect
Open

graouts wants to merge 1 commit into
w3c:mainfrom
graouts:web-animations-custom-effect

Conversation

@graouts

@graouts graouts commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Define the CustomEffect interface and the CustomEffectOptions dictionary. Addresses #6861.

webkit-commit-queue pushed a commit to graouts/WebKit that referenced this pull request Dec 5, 2026
https://bugs.webkit.org/show_bug.cgi?id=334376
rdar://194304792

Reviewed by Simon Fraser.

After some conversations on a CSS WG call and discussion on the spec issue [0] there
is now spec PR [1] for custom effects. As such this feature is advanced enough that
it should be made available as a tech preview.

[0] w3c/csswg-drafts#6861
[1] w3c/csswg-drafts#14946

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:

Canonical link: https://commits.webkit.org/328862@main

@ydaniv ydaniv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have some initial questions. Some may be a bit high level, so may require an issue of their own.

callback EffectCallback = undefined (double? progress,
(Element or CSSPseudoElement) currentTarget,
Animation animation);
callback CustomEffectCallback = undefined (double? progress,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this progress be mapped to the effect's progress or the animation's overallProgress?

Would it make sense, perhaps, to provide a property bag here, instead of a number, which can hold all the relevant timing options, and we can later expose more as needed.
So authors could write:

new CustomEffect(({ progress, overallProgress, elapsedTime }) => { ... })

<div dfn-type=dict-member class=members
dfn-for="CustomEffectOptions">

: <dfn>target</dfn>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would having a target mean for a CustomEffect? And how can you access it from within the callback?


<div class="parameters">

: double? progress

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does progress equal when we're outside the active range and fill doesn't persist the effect?

@@ -3263,33 +3257,83 @@
When this is <code>null</code>, the function SHOULD

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we perhaps, instead, rely on the removing replaced animations procedure?

For example, what would calling persist() do to CustomEffects?

Comment on lines 2212 to 2218
Issue: This whole feature needs to be revisited. The current thinking is that
rather than having custom effects, we should simply have an
<code>onupdate</code> callback on each <a>animation effect</a>. That
would allow, for example, augmenting an existing effect with a function
that performs logging or triggers additional actions at certain times.
With the current arrangement, doing this would require adding a parent
group just to achieve this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants