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] Add view() as a value for animation-timeline as a corresponding of scroll() #7587

Closed
ydaniv opened this issue Aug 9, 2022 · 3 comments

Comments

@ydaniv
Copy link
Contributor

ydaniv commented Aug 9, 2022

Scroll-animations define the scroll() for defining an anonymous ScrollTimeline as a timeline for an animation.
The spec currently doesn't have a corresponding value for ViewTimeline.

Should we add view()?
I believe this is useful just as much.

If so, it should:

  • take axis and inset as arguments
  • refer to same element as the subject of that timeline

I guess these are reasonable for an anonymous ViewTimline, otherwise use a name.

@hober hober added the scroll-animations-1 Current Work label Aug 11, 2022
@ydaniv
Copy link
Contributor Author

ydaniv commented Sep 13, 2022

@flackr your thoughts on this?

@ydaniv
Copy link
Contributor Author

ydaniv commented Sep 15, 2022

@fantasai asked for use-cases for this, I suppose the easiest (and very common one) is when an author simply wants an element to animate based on its own view progress inside its containing scrollport.
Very common for entry/exit animations.

So this:

.target {
  view-timeline: target-progress block;
  animation: 1s sparkle ease target-progress;
}

Becomes this:

.target {
  animation: 1s sparkle ease view();
}

Not a huge difference, but reduces the clutter in most common cases.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed Add view() to animation-timeline, and agreed to the following:

  • RESOLVED: Accept fantasai's PR for adding view() function to animation-timeline
The full IRC log of that discussion <TabAtkins> Topic: Add view() to animation-timeline
<TabAtkins> github: https://github.com//issues/7587
<fantasai> PR: https://github.com//pull/7988
<TabAtkins> flackr: so we defined scroll() for anonymous timelines, but htere was no convenient way to describe an anonymous view timeline
<TabAtkins> flackr: I believe elika already has a PR for this, so asking for resolution to use that
<fantasai> -> https://github.com//pull/7988/files
<bramus> +1 on resolving.
<TabAtkins> TabAtkins: I assume that anonymous view timelines work similar to anonymous scroll timelines? Just look in the tree for the nearest obvious thing?
<TabAtkins> fantasai: Yes, it looks up to the nearest scroll container
<TabAtkins> +1
<fantasai> ACTION fantasai: clarify that it applies to the element it's specified on
<TabAtkins> RESOLVED: Accept fantasai's PR for adding view() function to animation-timeline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants