Re: [csswg-drafts] [web-animations-1] Add steps for transitioning to/from a scroll timeline. (#5423)

(I'll add my thoughts to this, not sure if they'll help):

At a higher level, when considering how @scroll-timeline should work when timelines are switched around, we should keep the following guideline from css-animations-1 in mind:

> Changes to the values of animation properties while the animation is running apply as if the animation had those values from when it began.

This makes a lot of sense given how CSS works in general. We should probably try to not deviate from this without a good reason. (Some things deviate already, e.g. animation-play-state).

This means that the behavior we should aim for "by default" is:

 - Switching from DocumentTimeline/none -> ScrollTimeline: the result is whatever it would have been if the ScrollTimeline had been there from the start, i.e. the animation state is synchronized to the scroll position.
 - Switching from ScrollTimeline/none -> DocumentTimeline: the result is whatever it would have been if the DocumentTimeline had been there from the start, i.e. if you switch to the DocumentTimeline after five seconds, you get the same result as if DocumentTimeline was there initially, and you had waited five seconds. This may or may not be practical, but it's the behavior that follows from css-animations-1.

Pausing makes it more complicated. @ogerchikov seems to say that changing the current time of a paused animation is weird, and that we shouldn't do that, but instead change how the unpause procedure works. From the author's perspective, this means the timeline switch would not "take effect" until the animation is unpaused. I think that's fine ... paused animations are paused regardless of timeline. Makes sense to me.

@kevers-google asked if I could test "Option 0" with some practical examples and report what doesn't work. I think the main problem is the start time is preserved when switching timelines, which doesn't work at all for ScrollTimelines:

- Start with a DocumentTimeline that's initially running.
- When the pending-play commits (sorry for possibly Blink-specific language), the animation gets some start time greater than zero.
- Switch to a ScrollTimeline.
- Result: There is no effect value on scroll position zero, because that corresponds to a time that's less than the startTime.

Here's a similar issue, (that probably has the same root cause):

- Start with a DocumentTimeline that's initially paused.
- Switch to a ScrollTimeline, with a source that's at max scroll.
- Unpause.
- Result: There is no effect value for any scroll position except max scroll.

GitHub Notification of comment by andruud
Please view or discuss this issue at using your GitHub account

Sent via github-notify-ml as configured in

Received on Tuesday, 1 September 2020 12:51:15 UTC