Skip to content

fix: eliminate gradient flash on real mobile devices - #25

Open
jagadeep298218 wants to merge 2 commits into
mainfrom
fix/mobile-hero-gradient
Open

fix: eliminate gradient flash on real mobile devices#25
jagadeep298218 wants to merge 2 commits into
mainfrom
fix/mobile-hero-gradient

Conversation

@jagadeep298218

@jagadeep298218 jagadeep298218 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Hero section: Replace WebGL canvas with CSS gradient on mobile (mobile GPUs promote WebGL canvases to compositing layers that ignore parent opacity). Set scrub: true for zero-lag scroll tracking. Load CometTrailBackground with next/dynamic ssr: false.
  • Rocket trail section: Same fix — replace WebGL with CSS gradient on mobile so the SVG mask correctly clips the gradient to the trail shape. Set scrub: true instead of 0.6 to prevent flash from momentum scrolling.

Root cause

Mobile GPUs promote WebGL canvases inside SVG foreignObject to independent compositing layers that ignore SVG masks and parent opacity/visibility. Combined with numeric scrub lag (0.6s), momentum scrolling on real phones causes the gradient to flash full-screen before animations catch up.

Test plan

  • Open preview URL on a real phone (not emulator)
  • Scroll through hero section — gradient should fade in/out smoothly with no flash
  • Scroll to rocket trail section — gradient should stay clipped to the trail shape
  • Verify desktop behavior is unchanged

🤖 Generated with Claude Code

On real phones, momentum scrolling traverses the 250vh hero section in
under a second. Two issues combined to produce a full-screen gradient
flash:

1. The reveal (autoAlpha 0→1) and whiteout (autoAlpha 1→0) were
   separate ScrollTrigger tweens each with 0.6s scrub lag. During fast
   scrolling they caught up at different times, leaving the gradient at
   full opacity in the gap. Fixed by using scrub: true (zero lag) on
   mobile so both tweens track scroll position exactly.

2. The WebGL canvas inside SVG foreignObject was promoted to an
   independent GPU compositing layer on mobile, ignoring parent
   opacity/visibility. Fixed by replacing the WebGL path with a CSS
   gradient on mobile, set via GSAP (not JSX) so it appears atomically
   with autoAlpha: 0.

Additionally, CometTrailBackground is now loaded with next/dynamic
ssr: false to prevent the WebGL canvas from appearing in server HTML.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hackutd-co Ready Ready Preview Aug 4, 2026 1:17am

Same root cause as the hero gradient flash: mobile GPUs promote WebGL
canvases inside SVG foreignObject to independent compositing layers
that ignore SVG masks. Replace WebGL with CSS gradient on mobile and
use scrub: true for zero-lag scroll tracking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant