Skip to content

[css-animations-2][scroll-animations-1] should we be able to tell the scroll direction? #8401

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

Closed
brechtDR opened this issue Feb 6, 2023 · 2 comments

Comments

@brechtDR
Copy link

brechtDR commented Feb 6, 2023

It's a small suggestion with a big impact, but I was wondering if there will be a way to target the scroll direction of a animation-timeline by using CSS.

I know this is still in early stages, but playing around with this I created a little chicken running across the screen while scrolling and was wondering what could be the best way to prevent it from "moonwalking" when scrolling back up and instead use a different animation.

demo can be found on codepen using Chrome Canary

An idea for this is to anchor the animation to the animation-timeline direction.

.chicky {
  animation-timeline: chicken;
  animation-timeline-direction: AnimationNameOfForward forwards; /* animation name + direction */
}

.chicky {
  animation-timeline: chicken;
  animation-timeline-direction: AnimationNameOfBackwards backwards;
}

I am aware that this current idea needs multiple animation names on one element, which might be problematic. I've searched the issues, but maybe there is something I missed that could potentially be used for this.

So yes, a small idea with probably a big impact. I'm curious to hear possible solutions and other ideas, or things I missed.

@bramus bramus added the scroll-animations-1 Current Work label Feb 14, 2023
@argyleink
Copy link
Contributor

direction is 1 or -1 in greensock

@bramus
Copy link
Contributor

bramus commented Feb 21, 2023

Closing this one in favor of #6400, which als requests exposing the scroll direction. Using that possibility, you could add an extra scaleX(-1) to get the wanted result.

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

3 participants