Conversation
|
Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
Commits
|
JasonHowellSlavin
left a comment
There was a problem hiding this comment.
Were there any tests we could add? I see this is for c2, so not sure how that is set up.
| // Pause/resume based on scroll position. The router-marquee fills the viewport at | ||
| // the top of the page. Once the user has scrolled past half the viewport height, | ||
| // the block is considered offscreen. window.scrollY is reliable regardless of | ||
| // whether Lenis or native scroll is driving the animation. |
There was a problem hiding this comment.
Did you want to keep these comments in? I know we tend to leave comments out if we can.
| // Lenis loads after blocks, so window.lenis isn't set at init() time. | ||
| // On the first native scroll event, swap to lenis.on() if available so | ||
| // subsequent visibility checks run inside Lenis's RAF loop. |
There was a problem hiding this comment.
same here with these.
There was a problem hiding this comment.
Yep, notes for fast follow. Thank you!
| let fastScrollTimer; | ||
| window.addEventListener('wheel', (e) => { | ||
| if (Math.abs(e.deltaY) > 70) { | ||
| window.lenis.options.lerp = 0.6; |
There was a problem hiding this comment.
not sure here, but you mentioned above that lenis loads after blocks, so it might be good to optional chain here? Or check for window.lenis?
Thanks Jason! No, no C2 block as tests yet. This is for a test that will be going on the next month. We will have to circle back to address this. That's why comments are still in place for some follow up and knowledge. |
|
Closing for now. Will revisit while test is running. |
For the 2nd bullet point open up dev tools network tab and watch the media.mp4's stop loading when the router marquee scrolls out of view. This was using extra cpu resources while scrolling down the page. The cpu seems to spin up less. Give it a look.
Details around the first bullet point:
How it works:
deltaY > 80— threshold for “fast” scroll (a typical slow scroll is ~30–50, fast flick is 100+). Tune as needed.lerp = 0.4— during fast scroll, Lenis converges ~5x faster to the target position, so the RAF loop idles sooner instead of easing for hundreds of ms.Tuning knobs if needed:
Raise 80 threshold if it kicks in too eagerly on normal scrolling
Lower 0.4 toward 1.0 for even less inertia on fast scroll (1.0 = instant, no smoothing)
Raise 300 debounce if the smooth feel is snapping back too soon during continuous fast scroll
Test URLs: