Replies: 1 comment 2 replies
-
|
A few general recommendations for scroll-linked animations with Motion: 1. Setup / cancel scroll Your approach is reasonable. If the animation is tied to a section that may leave the viewport, registering it with If the animation is lightweight and global (e.g., page progress), keeping it registered is also fine. 2. When to use Use Example: frame.read(() => {
const height = this.clientHeight
frame.render(() => {
scroll(animate(...), {
offsets: [`${height}px`, ...]
})
})
})
If you're not reading layout values, wrapping in Rule of thumb:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello :),
I'm trying to do some performance debugging as we're having a lot of layout thrashing and style recalculations. I'm trying to get some good practices to share to my team, but there are some areas where I am unsure.
Setup/cancel
scrollTo create scroll-linked animations, we're registering them once when our section become in view, and we're unregistering them when the section become hidden:
Is this actually useful or is it better to keep the scroll-linked animations and never cancel them?
When to use
frame?I understand the theory of
framebut in practice, I'm having a hard time understanding when we must use them. For instance, is it when setting up a scroll linked animation is it recommended to wrap it under aframe.read?Thanks.
Beta Was this translation helpful? Give feedback.
All reactions