Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scroll-animations-1] Clarify that progress percentages must be between 0% and 100% #8552

Closed
bramus opened this issue Mar 9, 2023 · 7 comments · Fixed by #8553
Closed

[scroll-animations-1] Clarify that progress percentages must be between 0% and 100% #8552

bramus opened this issue Mar 9, 2023 · 7 comments · Fixed by #8553

Comments

@bramus
Copy link
Contributor

bramus commented Mar 9, 2023

While checking #5203 (comment), I noticed the scroll-animations-1 spec doesn’t mention that the percentages for the timeline ranges must be between 0% and 100%.

Furthermore the original <keyframe-selector> definition from css-animations-1 seems to have inadvertently been relaxed as the allowed range for <percentage> is no longer mentioned.

  • css-animations-1:

    <keyframe-selector> = from | to | <percentage [0,100]>
    
  • scroll-animations-1:

    <keyframe-selector> = from | to | <percentage> | <timeline-range-name> <percentage>
    

I think we should explicitly mention the allowed range.

@flackr
Copy link
Contributor

flackr commented Mar 9, 2023

Do we have to restrict it? Isn't something like contain -20% valid? It can be calculated out to a particular scroll position and we already have to handle keyframes outside of the animation range.

@bramus
Copy link
Contributor Author

bramus commented Mar 9, 2023

If there's no need to limit the accepted range, then please. Just to be sure: this would also play nice with negative offsets?

@flackr
Copy link
Contributor

flackr commented Mar 10, 2023

Yes, negative offsets calculate to their overall relative percentage. The only weird case we have right now is that view timelines do not start before the cover period so if you try to go less than 0% or more than 100% of the cover range it will interpolate from that position but not be active until you're in the cover range. I think this is probably fine, though I have often wondered whether we should make view timelines active for the entire scroll range so that cases like this would be supported.

@flackr flackr moved this from Needs triage to Low priority in Scroll linked animations [scroll-animations] Mar 10, 2023
@astearns astearns added this to Overflow in March 2023 VF2F Mar 11, 2023
@astearns astearns moved this from Overflow to Monday - Mar 20 in March 2023 VF2F Mar 11, 2023
@cdoublev
Copy link
Collaborator

cdoublev commented Mar 12, 2023

I am not sure if you are only discussing the <percentage> associated to <timeline-range-name> but if not, would this be backward-compatible?

Values less than 0% or higher than 100% are invalid and cause their <keyframe-block> to be ignored.

https://drafts.csswg.org/css-animations-1/#keyframes

Edit: nevermind (answer is no and the single <percentage> should be restricted), cf. #8553 (review).

Scroll linked animations [scroll-animations] automation moved this from Low priority to Done Mar 13, 2023
@fantasai fantasai reopened this Mar 13, 2023
Scroll linked animations [scroll-animations] automation moved this from Done to Needs triage Mar 13, 2023
@fantasai
Copy link
Collaborator

Merged in @bramus's PR to clarify that raw percentage @Keyframes are invalid. Keeping the issue open in case @flackr wants to follow up on any of his comments above.

@flackr
Copy link
Contributor

flackr commented Mar 16, 2023

This all looks good to me.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [scroll-animations-1] Clarify that progress percentages must be between 0% and 100%, and agreed to the following:

  • RESOLVED: %s outside the 0-100 range are valid in progress percentages
The full IRC log of that discussion <TabAtkins> fantasai: we're just clarifying we can do 'contain -20%' and it's valid
<TabAtkins> fantasai: Currently spec allows it
<bramus> +1
<TabAtkins> flackr: I support, these dynamic ranges can also compute outside their 0-100 range
<TabAtkins> astearns: objections?
<TabAtkins> RESOLVED: %s outside the 0-100 range are valid in progress percentages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
March 2023 VF2F
Monday - Mar 20
Development

Successfully merging a pull request may close this issue.

5 participants