w3c / csswg-drafts

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

[scroll-animations-1] Typo in calculation of ViewTimeline progress #10960

Open nmoucht opened 1 month ago

nmoucht commented 1 month ago

In https://drafts.csswg.org/scroll-animations-1/#view-timeline-progress, it defines the denominator of the progress calculation as

range is the scroll offset corresponding to the start of the cover range minus the scroll offset corresponding to the end of the cover range

but since the scroll offset of the start cover range is always smaller than for the end cover range, this will result in a negative progress. Shouldn't these be flipped (ie cover range end - cover range start)?

nmoucht commented 1 month ago

@flackr @kevers-google @andruud

stubbornella commented 1 month ago

@flackr can you take a look at this or is there someone else who would be better?

ydaniv commented 1 month ago

Yes, looks like a typo, should be:

progress = (current - start) / (end - start)

With regard to corresponding scroll offsets. I think we wrote that in one of the issues but can't find it now.