Portfolio
  • 01Home
  • 02Projects
  • 03About
  • 04Skills
  • 05Lab
  • 06Writing
  • 07Contact

© 2026 Hamza Syrage

LabView all
Arrow FieldCursorCursor SpotlightCursorGooey CursorCursorImage CompareMediaInteractive ChartDataMagnetic ButtonInteractionMarquee RevealTypographyMorphing ShapeAnimationsNested ViewsOverlaysOdometer CounterDataParticle ConstellationCanvasRipple ClickButtonsScroll RevealScrollShuffle GridLayoutStep WizardNavigationTabsNavigationTilt CardCards

UI Experiments

All Lab Entries
Cursor

Cursor Spotlight

A spring-physics spotlight that follows your cursor with mix-blend-difference inversion.

Move your cursor over the box. Tap to feel the spring compress.

Move your cursor

#Step 1 - Mouse position

Start simple: track the cursor with useState and position a div at those coordinates. No animation, no spring, just raw onPointerMove updating state.

Move your cursor
tsx
Loading...

#Step 2 - CSS transition

Add transition: transform 300ms ease to smooth the movement. It feels smoother, but the timing is fixed and it can't react to how you move. Try interrupting it mid-animation.

Smooth but robotic
tsx
Loading...

#Step 3 - Spring physics

Replace the CSS transition with useSpring. Now the animation reacts to your movement, overshoots when you move fast, settles gently when you stop. Drag the sliders to feel the difference.

Spring overshoots then settles
Spring physics
Stiffness300
Damping25
Mass1
tsx
Loading...

#Step 4 - Opacity fade

Add a separate opacity spring that fades the spotlight in on onPointerEnter and out on onPointerLeave. The fade uses its own spring so it doesn't fight with the position.

Fades in and out smoothly
tsx
Loading...

#Step 5 - Blend mode

Add mix-blend-difference. The spotlight now inverts whatever is behind it, text, images, anything. Without it, you just get a yellow circle on top.

Inverted text
tsx
Loading...

#Step 6 - Press feedback

Add onPointerDown / onPointerUp to compress the spotlight to 85% on press. A micro-interaction that makes it feel physical.

Inverted text
tsx
Loading...

#Configuration

Tweak everything: spring values, spotlight size, press scale. The code updates in real-time.

Move your cursor
All parameters
Size96px
Spring physics
Stiffness300
Damping25
Mass1
tsx
Loading...