Skip to content

Latest commit

 

History

History
107 lines (87 loc) · 3.85 KB

File metadata and controls

107 lines (87 loc) · 3.85 KB

Background Animation Optimization

Overview

Replaced the GPU-intensive Continuous Aurora Background Animation with a more efficient, lightweight background system to improve performance and reduce GPU usage.

Changes Made

1. Aurora Background Component (src/components/ui/aurora-background.tsx)

Before:

  • Heavy blur effects (blur-[100px], blur-[120px], blur-[90px])
  • Continuous 60-second linear animations with animate-aurora
  • Complex gradient animations with background-position changes
  • Multiple layered animated elements with pseudo-elements
  • GPU-intensive transform3d and will-change properties

After:

  • Static gradient base with subtle color transitions
  • Minimal animated overlay with gentle movement
  • Optional subtle particle effects using CSS-only animations
  • Significantly reduced GPU usage
  • Maintained visual appeal with better performance

2. CSS Animations (src/app/globals.css)

Removed:

  • @keyframes aurora - Complex background-position animation
  • .animate-aurora - GPU-intensive animation class

Added:

  • @keyframes gentle-shift - Subtle gradient movement (20s duration)
  • @keyframes float-slow - Gentle particle floating (15s duration)
  • @keyframes float-delayed - Delayed particle animation (18s duration)
  • @keyframes float-gentle - Rotating particle animation (22s duration)

3. Tailwind Configuration (tailwind.config.js)

Removed:

  • aurora keyframe definition
  • aurora animation class

Added:

  • gentle-shift keyframe and animation
  • float-slow keyframe and animation
  • float-delayed keyframe and animation
  • float-gentle keyframe and animation

Performance Benefits

GPU Usage Reduction

  • Before: Continuous GPU layer creation with transform3d and will-change
  • After: Minimal GPU usage with simple transform and opacity changes

Animation Efficiency

  • Before: Complex background-position animations running every frame
  • After: Simple transform and opacity animations with longer durations

Visual Quality

  • Before: Heavy blur effects causing rendering overhead
  • After: Clean gradients with subtle movement maintaining visual appeal

Battery Life

  • Before: High GPU usage leading to increased power consumption
  • After: Minimal resource usage improving battery life on mobile devices

Technical Details

New Animation Properties

  • Duration: Longer animation cycles (15-22 seconds) vs. previous 60-second continuous loop
  • Easing: ease-in-out for smoother, more natural movement
  • Delays: Staggered animation starts to create organic movement patterns
  • Opacity: Low opacity values (0.1-0.5) for subtle visual effects

Browser Compatibility

  • Uses standard CSS transforms and opacity changes
  • Compatible with all modern browsers
  • Respects prefers-reduced-motion settings for accessibility

Reduced Motion Support

The existing reduced motion support in globals.css continues to work:

@media (prefers-reduced-motion: reduce) {
  .animate-aurora {
    animation: none;
  }
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Testing Results

  • ✅ Homepage loads with new efficient background
  • ✅ Results page displays correctly with new background
  • ✅ Visual appeal maintained while reducing GPU usage
  • ✅ Animations are smooth and subtle
  • ✅ No performance degradation observed

Migration Notes

  • No breaking changes to component API
  • Existing AuroraBackground component usage remains the same
  • All pages using the component automatically benefit from the optimization
  • No additional configuration required

Future Improvements

  • Consider adding user preference for animation intensity
  • Implement performance monitoring to track GPU usage improvements
  • Add option to completely disable animations for maximum performance