โœฆ StealThis .dev

Hero Code Space Background

Immersive 3D perspective background with floating code panels, scroll-driven depth animation, and responsive depth culling.

Open in Lab
css javascript
Targets: HTML

Code

Hero Code Space Background

An animated hero background that places floating code panels in 3D perspective space. Each panel drifts towards the viewer, creating a depth tunnel effect. Scroll position drives the animation speed and panels respawn at the far end when they pass the camera.

How it works

  • A perspective container uses perspective + perspective-origin CSS
  • Each panel is positioned with randomized X, Y, and Z coordinates in 3D space
  • A requestAnimationFrame loop increments the Z position of every panel
  • When a panel crosses Z = 0 (camera plane) it resets to the back
  • Panels are color-coded by type (blue = JS, green = CSS, pink = TS, red = SQL)
  • Scroll velocity adds temporary momentum

Notes

  • Respects prefers-reduced-motion โ€” stops animation if the user prefers reduced motion
  • Depth culling hides panels beyond a threshold on small screens for performance