Skip to content

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
Katotodan:chore/gsap-animation
Closed

fix(animations): mobile scroll animation — earlier trigger, no reverse on scroll-up (the opacity)#161
Katotodan wants to merge 6 commits intomeshery-extensions:masterfrom
Katotodan:chore/gsap-animation

Conversation

@Katotodan
Copy link
Copy Markdown
Contributor

@Katotodan Katotodan commented Mar 11, 2026

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

Desktop Mobile
Entrance animation Scrub-linked (unchanged) Plays once as element enters viewport
Scroll-up reversal Yes (scrub) No (toggleActions: "play none none none")
Recession effects Yes Skipped
Trigger timing Unchanged ~5% earlier

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

Signed commits

  • Yes, I signed my commits.

Signed-off-by: DANIEL KATOTO <katotodan@gmail.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 11, 2026

PR Preview Action v1.6.3
Preview removed because the pull request was closed.
2026-04-23 13:00 UTC

@Katotodan Katotodan marked this pull request as draft March 11, 2026 05:41
@Katotodan Katotodan changed the title Improve mobile scroll animations by disabling scrub behavior fix(animations): mobile scroll animation — earlier trigger, no reverse on scroll-up (the opacity) Mar 30, 2026
@Katotodan Katotodan marked this pull request as ready for review March 30, 2026 19:14
@Bhumikagarggg
Copy link
Copy Markdown
Contributor

@Bhumikagarggg
Copy link
Copy Markdown
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 🙂

@Katotodan Katotodan closed this Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants