Re: [csswg-drafts] [css-animations-2] Move scroll and event animation triggers to independent namespace (#12336)

@fantasai 

> Yes, this makes them stateless. An animation that was started by a timeline trigger can be ended by an event trigger; etc. Each trigger's start and end criteria are defined independently of each other: a timeline trigger starts when you switch from being outside the start range to inside, and ends when you switch from being inside the continue range to outside; similar for event triggers.

That's fine.
There's still one issue with the initial `did trigger` state. We need to somehow store a flag that says we don't trip the `end` trigger until the `start` trigger was tripped once - or basically, we need to make sure the animation stays in the "before" phase until playing from first trip of the `start` trigger.

> If we need to pair them up, e.g. so that certain end triggers can only end animations started by certain start triggers

I think that's way too specific for the declarative interface. I think we'll be fine without such ability.

> Ah, ok, so we'd have
> animation-start-trigger-action: once | always
> animation-end-trigger-action: reset | pause | alternate
> ?

Yes, that or perhaps `reverse` is more appropriate.

> I guess it depends, do you want to alternate the direction only if there's an end trigger flipping the direction, or every time the start trigger is initiated (regardless of whether there was an end)? Do we need both options?

I can only think of reversing direction on end trigger.
You could still get something like "flip on every click" with that. But IMO that should suffice.

> Which I guess raises the question of, do we want a start trigger to be able to restart a playing animation, or only trigger if the animation is stopped/paused, and do we need control over that?

Initially I thought it would restart since that point couldn't be reached with timeline triggers, however, `animation.play()` does not restart on a subsequent call, and event triggers took advantage of that, which I agree is a better choice.

-- 
GitHub Notification of comment by ydaniv
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12336#issuecomment-3146546431 using your GitHub account


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

Received on Saturday, 2 August 2025 14:45:40 UTC