[csswg-drafts] [web-animations-2] Should Triggers have any effect on non time-driven animations? (#11646)

ydaniv has just created a new issue for https://github.com/w3c/csswg-drafts:

== [web-animations-2] Should Triggers have any effect on non time-driven animations? ==
Currently [AnimationTriggers' effect on time-driven animations](https://drafts.csswg.org/web-animations-2/#triggers-overview) is well defined:

> An animation trigger is used to control the playback of its associated [animation](https://drafts.csswg.org/web-animations-1/#animation) for time-driven animations.

Should there also be an effect of Triggers on non time-driven animations, e.g. scroll-driven animations?

### Option 1

No effect, they are simply ignored.

### Option 2

They behave exactly the same.
If we create an `Animation()` in WAAPI it doesn't apply any effect until `.play()` is invoked. The same is true for scroll-driven animations.
Using a Trigger practically replaces the need to call `.play()`, so we could just define that to have the same effect.
Now we need to define how each [`type`](https://drafts.csswg.org/web-animations-2/#trigger-types) interacts with these animations:

- `once`: the animation becomes active once trigger's active interval is entered.
- `repeat`: the animation switches between active/inactive on trigger's active interval entry and exit.
- `alternate`: the animation switches direction on trigger's active interval entry and exit.
- `state`: the animation's play-state is toggled on trigger's active interval entry and exit.

-------------------

Since I'm not seeing any reason to prevent it, I'm leaning towards option 2.

**Proposal**: amend the spec to say AnimationTriggers' effect is apply to all animations time-based and non time-based alike.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11646 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 4 February 2025 10:43:19 UTC