Fix the performance issue where infinite animations continue running …#91
Conversation
…even when the related section is off-screen.
📝 WalkthroughWalkthroughThree animation-heavy components ( ChangesViewport-gated looping animations
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
DESCRIPTION
• Before:
If you had a beautiful floating animation in the
Hero section, it would calculate new pixel positions 60 times
per second indefinitely, even if the user scrolled all the way
down to the footer.
• After:
We placed an invisible boundary line (a "margin")
around sections with infinite animations. When the user
scrolls past that boundary, the code detects that the section
is out of sight and pauses the animation. When the user
scrolls back up, it instantly resumes. The user's visual
experience is completely unaffected because the animations are
only paused when they literally cannot be seen.
BENIFITS
-- Significantly Improved Battery Life on Mobile Devices
-- Prevents Devices from Overheating
-- Better SEO and Core Web Vitals
CLOSES #30
Summary by CodeRabbit