fix(animations): mobile scroll animation — earlier trigger, no reverse on scroll-up (the opacity)#161
Closed
Katotodan wants to merge 6 commits intomeshery-extensions:masterfrom
Closed
Conversation
Signed-off-by: DANIEL KATOTO <katotodan@gmail.com>
|
Signed-off-by: DANIEL KATOTO <katotodan@gmail.com>
Signed-off-by: DANIEL KATOTO <katotodan@gmail.com>
Signed-off-by: DANIEL KATOTO <katotodan@gmail.com>
Contributor
|
https://github.com/user-attachments/assets/cfcf2137-39ee-4700-9d3a-a07ca35328b3 |
Contributor
|
@Katotodan Thank you for your contribution! Let's discuss this during the website call tomorrow at 5:30 PM IST | 7 AM CST Add it as an agenda item to the meeting minutes, if you would 🙂 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On small devices, scrub-based ScrollTrigger animations caused two issues: content appeared late because the animation range spanned a large portion of the viewport, and every entrance/recession animation reversed when scrolling back up — hurting both UX and CPU.
Solution
Introduces a thin mobile-detection layer with no structural changes to the desktop experience.
isMobile — a matchMedia('(max-width: 768px)') flag computed once on load, used as a branching condition throughout.
stConfig(trigger, start, end) — a helper that returns a ScrollTrigger config object. On mobile it shifts start ~5% earlier and sets toggleActions: "play none none none" (time-based, no scrub). On desktop it returns the original scrub config unchanged.
scrubEach() — updated with the same mobile branch inline.
Recession effects (hero-glass wrapper, hero-section, demo-section) are guarded with if (!isMobile) so the fade/scale-out animations don't run — and therefore don't reverse — on small screens.
Behaviour after this PR
Testing
Verify on a real device (≤768px width) by scrolling down (content animates in promptly) and back up (content stays visible, no jank).
Use the preview link on a mobile device to view the changes
Part of Javascript: Improve animation performance #146
Signed commits