Re: [csswg-drafts] [scroll-animations-1] Triggering scroll-based animations once (#7478)

> Are there sites that use this that aren't just using scroll triggered animations - for which we would have a different mechanism for this (described in issue https://github.com/w3c/csswg-drafts/issues/8942)?

Preferably, the mechanism to have them run only once would be the same.

Maybe we are looking at it wrongly? Right now we seem to be thinking in terms of “how many triggers” but maybe we should look at it in terms of the animation’s lifetime. I.e. is the (finite) timeline allowed to go back in progress or not? Options could be: `allowed` _(default)_, `not-allowed` _(thereby creating a “sticky timeline” that only can go up)_, `allowed-until-ended`.

> When do they consider the animation to have finished and to not start again? At the point when you scroll past the end point of the animation? I.e. it would still restart if you scroll past the start point, back up and then past it again?

For SDA, I’ve [prototyped a demo](https://codepen.io/bramus/pen/Jjwdrwg) that removes the animation once the animation reached `animationend`. As long the `animationend` was not reached, the animation will go back. This reflects the `allowed-until-ended` that was suggested in the previous paragraph.

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


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

Received on Wednesday, 23 August 2023 12:56:44 UTC