-
Notifications
You must be signed in to change notification settings - Fork 708
[scroll-animations] Rework use cases #4354
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
Comments
Possible use case categories: 1. Scroll-triggered animationsIt is common to trigger an animation to run when the scroll position reaches a certain point. For example, a navigation bar that changes highlight based on position. TODO: Draw simple example; show CSS syntax, JS syntax Another common example is having the page layout update at certain points in the scroll such as having a full-screen navigation panel shrink to a navigation bar after the initial scroll (e.g. http://fantasy.co/work) TODO: Draw simple example; show CSS syntax, JS syntax Real-world examples:
In other cases the animation plays continually within a certain scroll range and stops immediately outside that range. TODO: Simple example with CSS/JS Real-world examples: In other cases, the animation stops playing once the scroll position leaves a certain range but continues the current iteration. TODO: Simple example with CSS/JS Real-world examples:
Multiple scroll-ranges? Real-world examples:
2. Scroll-triggered style changesTODO: Simple example with CSS/JS Real-world examples: 3. Scroll-linked animationsAnother common effect is to use the scroll position to control the progress of an animation. For example, the scroll position might be used to control the zoom or color of an element. TODO: Simple example with CSS/JS Another example is a progress-bar that tracks scroll position such as a horizontal scroll-bar in the navigation bar that indicates the readers' position in a long article. Real-world examples:
4. Combination scroll and time-based animationsIn still other cases, an animation might follow the scroll-position up to a certain threshold point but beyond that point, it may play to completion regardless of scroll position. TODO: Some sort of pull-to-refresh example with JS Real-world examples: |
Thanks @birtles I wrote the use case again, and changed the diagram to the SVG. (I'm going to remove the unnecessary information from SVG images) |
I've made a few tweaks to the first use case but it's going to take a bit longer. I'll finish it off tomorrow. You can use SVGO for cleaning up the SVG. |
As per WICG/scroll-animations#22 (comment), we should include an example which uses block/inline + start/end scroll offset + writing-mode to make the interaction of those clearer. |
Would it be possible only to trigger scroll-based animations once? This is an option in the scroll-trigger library 'AOS' (or 'Animate on Scroll') – https://github.com/michalsnik/aos#1-initialize-aos The use case would be: Sometimes, I would like to scroll back up a page and re-read content without having it 'introduced' a second time with animation. For me, this is like a halfway house between some animation but not too much. |
@JayGeorge Filed your comment into its own issue at #7478 |
I think we can improve the Use cases section in the following ways:
ScrollTimeline
is an interface name, not a use case. A use case is something like, "Update navigation to highlight page section".a. Triggering use cases
b. Scroll timeline use cases
c. Complex combinations of both
getAnimations[0]
.The text was updated successfully, but these errors were encountered: