csswg-drafts icon indicating copy to clipboard operation
csswg-drafts copied to clipboard

[css-animations-2] interaction between the `timeline` property and `animation-timeline` property

Open graouts opened this issue 1 year ago • 2 comments

CSS Animations Level 2 has a section detailing how setting properties via the Web Animations APIs can override related CSS properties. For instance:

After a successful call to play() or pause() on a CSSAnimation, any subsequent change to the animation-play-state will no longer cause the CSSAnimation to be played or paused as defined in § 4.5 The animation-play-state property.

This section makes no mention of setting the timeline property of an animation. I believe the spec should detail what happens when setting animation-timeline after the timeline property has been modified via the JS bindings.

Additionally, should setting the effect property have any effect on further changes to the animation-timeline property? Currently, the spec says so:

After successfully setting the effect of a CSSAnimation to null or some AnimationEffect other than the original KeyframeEffect, all subsequent changes to animation properties other than animation-name or animation-play-state will not be reflected in that animation. Similarly, any change to matching @keyframes rules will not be reflected in that animation. However, if the last matching @keyframes rule is removed the animation must still be canceled.

But the timeline being a property of the animation, and not the effect, should animation-timeline be excluded here?

graouts avatar Oct 21 '24 09:10 graouts

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

graouts avatar Oct 21 '24 09:10 graouts

WebKit is making a change via in its implementation via https://github.com/WebKit/WebKit/pull/35513 such that setting timeline via the JS property will make any further change to animation-timeline not affect the timeline set on the animation. However setting effect will not interfere.

graouts avatar Oct 21 '24 09:10 graouts

+1 to both

ydaniv avatar Feb 07 '25 20:02 ydaniv

Thanks for calling this out, this was an oversight. I agree with both choices.

flackr avatar Feb 07 '25 21:02 flackr

@flackr can we resolve on this one async?

ydaniv avatar Feb 08 '25 09:02 ydaniv

@graouts was this done via #11812 ?

ydaniv avatar Mar 13 '25 15:03 ydaniv

@graouts was this done via #11812 ?

I believe that is correct! If @birtles or @flackr agree as well, I believe we can close this.

graouts avatar Mar 17 '25 12:03 graouts

Agreed, I don't think we need a resolution, this falls within the realm of behavior that was always intended, but overlooked in the spec text.

flackr avatar Mar 17 '25 15:03 flackr