StealThis .dev

Magnetic 3D Orbs

A field of 280 glowing orbs with spring physics — each orb is attracted to the cursor's 3D position and drifts back to its home when the cursor is still.

Open in Lab
threejs instancedmesh webgl
Targets: JS HTML

Code

Magnetic 3D Orbs

A field of 280 glowing spheres rendered via THREE.InstancedMesh for GPU-efficient instanced drawing. Each orb has:

  • Spring physics: attracted to cursor with constant force + restored to home position
  • Additive blending: overlapping orbs near the cursor glow brighter without post-processing
  • Color gradient: warm orange-red near cursor, cool blue-purple when far
  • Random noise: small per-frame jitter for organic, alive feel

Implementation notes

  • Uses THREE.InstancedMesh with DynamicDrawUsage for per-frame matrix updates
  • MeshBasicMaterial + AdditiveBlending gives the glow effect without shaders
  • Per-instance colors via vertexColors: true and setColorAt()
  • Cursor mapped to 3D via raycasting against a frontal plane