One of the most powerful patterns in Aurora Drift is the use of Framer Motion’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/aurora-drift/llms.txt
Use this file to discover all available pages before exploring further.
MotionValue system to drive continuous, pointer-reactive animations with zero React re-renders. A MotionValue is a special reactive container — it holds a number (or string) and notifies subscribers directly on the animation frame loop, completely bypassing React’s reconciliation cycle. This makes it ideal for anything that needs to update 60+ times per second in response to mouse movement, scroll, or physics output.
What Are MotionValues?
AMotionValue is created with useMotionValue(initialValue). It has a .set() method to push new values into it and a .get() method to read the current value. When you pass a MotionValue to a motion.* element’s style prop, Framer Motion subscribes to it and applies DOM updates directly — no virtual DOM diffing, no state, no re-renders.
Because
MotionValue.set() does not call setState, it does not trigger React re-renders. The component that creates the MotionValue mounts once and stays mounted — only the underlying DOM transform is updated on every frame. This is what makes Aurora Drift’s pointer effects so performant, even at 60fps.Aurora Background Parallax
AuroraBackground.js uses two MotionValues — x and y — to track the normalized mouse position across the viewport. These are then piped through useSpring to produce a smoothly lagging springX and springY, which drive the aurora SVG layer.
How the Coordinates Are Mapped
Mouse position is normalized to a±10 pixel range (centered at 0) so the parallax shift is subtle:
- At the left edge of the screen,
normalizedX = -10 - At the center,
normalizedX = 0 - At the right edge,
normalizedX = +10
Full Parallax Setup
Cursor Glow
CursorGlow.js creates a 300×300px radial-gradient orb that follows the cursor. The MotionValues are initialized at -100 (off-screen) so the glow doesn’t flash at the origin before the first mousemove.
Offset Calculation
The glow div is300px × 300px. To keep it centered on the cursor, the position is offset by half its size:
Full Cursor Glow Setup
How the Two Patterns Compare
Aurora Parallax
Source: Mouse position normalized to
Spring:
Effect: The aurora layer drifts slowly behind cursor movement, creating depth
Initial value:
±10pxSpring:
damping: 50, stiffness: 400Effect: The aurora layer drifts slowly behind cursor movement, creating depth
Initial value:
0 (centered)Cursor Glow
Source:
Spring:
Effect: Radial glow orb trails the cursor with a soft, springy lag
Initial value:
clientX/Y - 150 (centered on cursor)Spring:
damping: 25, stiffness: 200, mass: 0.5Effect: Radial glow orb trails the cursor with a soft, springy lag
Initial value:
-100 (hidden off-screen)The MotionValue Pipeline
Both patterns follow the same three-stage pipeline:Raw MotionValue
Created with
useMotionValue(initialValue). Updated imperatively via .set() inside an event handler. This is the “target” — where the animation wants to go.Spring Follower
Created with
useSpring(rawValue, config). This derived MotionValue automatically chases the raw value with physics, producing smooth interpolated output on every animation frame.Going Further: useTransform
Performance Characteristics
| Approach | Re-renders on mouse move | Frame loop updates | Suitable for 60fps? |
|---|---|---|---|
useState + CSS | Yes — every pixel | Via React reconciler | No — jank at high frequency |
useMotionValue + spring | Never | Direct DOM via RAF | Yes |
| CSS transitions on class change | No | Browser compositor | Yes, but no physics control |