Re: [csswg-drafts] [scroll-animations] Behavior of scroll-linked animations in the first frame (#5261)

> 1. Accept the limitation

I don't know how bad would an initial "flash of no effect value" before the animation takes effect on frame 2 is.
It only matters if the animation has a valid value for initial scroll offset. Also a fairly easy mitigation exists where author can given the target of the animation an initial style value that is equivalent to animation effect at initial scroll offset.

But I agree not requiring authors to worry about it is better.

> 2. Somehow do multiple passes of style/layout to get the information we need

I am with @flackr that if we are allowed to do this then it solves the issue in the general case and does not burden the authors.  Also agree that we should limit this for the first time a timeline is constructed.

Would we ever need to have more than two passes? In the first pass we construct the timeline and layout its scroll source. In the second pass we initialize the timeline which initialized its animations which can invalidate style and layout again. I don't expect any script to run in between these two passes so on second pass we shouldn't construct any new timelines. So perhaps two pass is enough.

I checked and [resize observer](https://caniuse.com/#feat=resizeobserver) is supported by all major engines which is a good sign. Though I am not sure if they all support this multi-pass behavior as specified.


> 3. Provide a reasonable default and give the author tools to tweak the initial phase of the timeline

I couldn't come up with a good idea here but here are some thoughts:
 - One idea I had was to have scroll timelines to be initialized with `before` phase. This would solve the issue for animations with   `backwards` fill mode but it is not a general solution.
- Another idea was to assume an initial scroll offset zero. But with things like css scroll snap which modify initial scroll offset zero is simply not correct in general case.
- I don't think we need to give a way for authors to tweak initial value/phased of the timeline. As I mentioned before just providing an initial style for the animation target is a cleaner way to do this.


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

Received on Thursday, 25 June 2020 13:52:58 UTC