w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.46k stars 657 forks source link

[web-animations-2] [scroll-animations-1] Auto-aligning the start time of an animation associated with a scroll timeline #10965

Open graouts opened 1 day ago

graouts commented 1 day ago

I'm working on implementing Scroll-driven Animations in WebKit and having some trouble understanding how the start time of an animation associated with a scroll timeline ever gets resolved.

From my understanding, the start time of such an animation is set by the auto-aligning the start time procedure. Per HTML Processing Model: Event loop:

When updating timeline current time, the start time of any attached animation is conditionally updated. For each attached animation, run the procedure for calculating an auto-aligned start time.

So each time animations are updating, we have a chance to auto-align the start time of scroll-driven animations. But, the auto-aligning the start time procedure step 3 says:

If play state is idle, abort this procedure.

The play state is idle when:

All of the following conditions are true:

My assumption is that the start time is unresolved since we're yet to set it via the auto-align the start time procedure. We do not have any pending tasks since when initially playing that scroll-driven animation, we aborted the play procedure after step 10:

If the following three conditions are all satisfied:

abort this procedure.

And the current time is unresolved precisely we don't yet have a start time and return unresolved in this step of the calculating the current time of an animation procedure:

If any of the following are true:

The current time is an unresolved time value.

Therefore it is unclear to me when an animation associated with a scroll timeline can ever have a resolved start time or current time. What am I missing?

graouts commented 1 day ago

Cc @andruud, @flackr and @kevers-google (and apologies for initially assigning this issue to them).

johannesodland commented 1 day ago

I think this is the same issue I ran into in https://github.com/w3c/csswg-drafts/issues/9871. I'm closing that issue as a duplicate in favor of yours.