CSS 3D & Perspective
Rotating Cube
Glowing sage-green wireframe cube slowly auto-rotates in CSS 3D with a subtle sine-wave tilt; pointer movement offsets the rotation to follow the cursor.
csslight complexitymoderate motionpointer
Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited
Worth keeping?
Votes steer what gets built next — sign in to cast one, free to read
When to use it
Hero backgrounds, tech or data product landing pages, dark-mode ambient displays needing a 3D accent.
When not to
Light backgrounds (hardcoded dark charcoal). Contexts where pointer distraction competes with UI controls above the cube.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change the cube face glow color from sage to gold by replacing #B1CCA4 and rgba(177,204,164,.5) with #ffe07e and rgba(255,220,120,.5), and slow rotation to ry+=0.25. Theme: dark tokens live in :root, the light variant in :root[data-theme="light"]; ?theme=light or a {type:'forever:theme'} postMessage switches at runtime.
Safe to edit
- rotation speed (ry += 0.5)
- pointer influence range (tx *40 / ty *30)
- face glow color (#B1CCA4)
- cube size (38vmin)
- perspective depth (600px)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- visibilitychange stop/start guards
- prefers-reduced-motion static fallback
- viewport cache with resize listener (never per-frame)
- theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
Known limitations
- Background color hardcoded to dark navy — must edit CSS to use on light pages
- CSS 3D with backface-visibility:visible can look odd on some rotations without a depth cull tweak
More CSS 3D & Perspective components
- Card Deck FanSeven gold-and-mauve playing cards fan open and closed in a sine-wave 3D arc using CSS rotateZ and perspective transform.
- Coverflow RingEight vivid gradient cards orbit in a 3D coverflow ring with CSS perspective and per-card reflections. Pointer X position steers rotation speed.
- Folding Paper4-panel paper accordion folds and unfolds in a zig-zag CSS 3D motion, slowly rotating on a dark green background. Cream front and sage back faces alternate.
- Isometric Blocks3x3 grid of soft lilac CSS 3D cubes bobs in a staggered sine wave on a dark lilac-tinted ground. Three shaded faces per cube simulate isometric lighting.
- Parallax DepthA glowing sun with colored orbiting dots on layered CSS 3D planes that tilt and parallax toward the pointer; auto-orbits until interaction.
- Wireframe GlobeA teal wireframe globe of 6 longitude and 5 latitude rings rotates in CSS 3D perspective; pointer steers spin speed and tilt angle.