Skip to content

176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.

fix: hide the Scroll-Driven 3D Rotation labels on faces that turn away, darken its scroll bar, and correct its README

matin362a9c5fae9d
diff --git a/animations/06-3d-advanced/scroll-driven-3d-rotation/README.md b/animations/06-3d-advanced/scroll-driven-3d-rotation/README.md
index 9910eded..9def420f 100644
--- a/animations/06-3d-advanced/scroll-driven-3d-rotation/README.md
+++ b/animations/06-3d-advanced/scroll-driven-3d-rotation/README.md
@@ -42,7 +42,7 @@ function lerp(a, b, t) { return a + (b - a) * t; }
The demo's keyframes are four poses, one for each quarter of the scroll: a quarter turn to the side, a forward tilt, a larger size (1.4 times), then turning round to show the back.
-**Smooth scrub** adds a lerp each frame to ease between the raw scroll value and the applied rotation — this gives a cinematic feel:
+**Smooth follow** adds a lerp each frame to ease between the raw scroll value and the applied rotation — this gives a cinematic feel:
```js
function animate() {
@@ -63,7 +63,7 @@ The demo asks for another frame only while the cube is still catching up, and st
## Production notes
- **CSS Scroll-Driven Animations API** (Chrome 115+): `animation-timeline: scroll()` and `animation-range` can drive CSS transforms directly without JavaScript. The spec covers this natively, but browser support is still catching up for complex choreography.
-- **GSAP ScrollTrigger**: in production, `gsap.timeline().to(obj, { rotateY: 360 }).scrollTrigger({ trigger, scrub: 1 })` is the idiomatic implementation. `scrub: 1` adds a 1-second smoothing lag.
+- **GSAP ScrollTrigger**: in production, `gsap.to(obj, { rotateY: 360, scrollTrigger: { trigger, scrub: 1 } })` is the idiomatic implementation. `scrub: 1` adds a 1-second smoothing lag.
- **Performance**: CSS `transform` on a 3D element with `will-change: transform` runs on the compositor thread — scroll-driven rotation does not trigger layout or paint.
- **Mobile scroll budget**: 400vh of scroll on mobile means the user must scroll a lot. Consider reducing section height for mobile, or switching to a swipe-driven (touch-drag) interaction.
diff --git a/animations/06-3d-advanced/scroll-driven-3d-rotation/index.html b/animations/06-3d-advanced/scroll-driven-3d-rotation/index.html
index efda574c..0f6b70c5 100644
--- a/animations/06-3d-advanced/scroll-driven-3d-rotation/index.html
+++ b/animations/06-3d-advanced/scroll-driven-3d-rotation/index.html
@@ -24,7 +24,7 @@
:root{--ui-accent:#3fd6c4}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
/* The stage is the scroller: its content is four stage heights tall, and the frame that holds the cube stays pinned */
- .stage{background:#04060c;overflow-y:auto;overflow-x:hidden}
+ .stage{background:#04060c;overflow-y:auto;overflow-x:hidden;color-scheme:dark}
.scroll-content{height:400%;position:relative;--cube:120px}
/* The cube is 120px; on a stage under about 285px tall it shrinks with the stage, so its tilted, enlarged pose stays inside */
@supports (height:1cqh){
@@ -37,7 +37,9 @@
.obj-wrap{transform-style:preserve-3d;will-change:transform;transition:transform 0ms linear}
/* CSS cube */
.cube{width:var(--cube);height:var(--cube);position:relative;transform-style:preserve-3d}
- .face{position:absolute;width:var(--cube);height:var(--cube);border:2px solid rgba(88,166,255,.5);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600;color:rgba(88,166,255,.9);letter-spacing:1px}
+ .face{position:absolute;width:var(--cube);height:var(--cube);border:2px solid rgba(88,166,255,.5);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:600;color:rgba(88,166,255,.9);letter-spacing:1px;transform-style:preserve-3d}
+ /* The faces are see-through: each label hides when its face turns away, or it would show mirrored through the front */
+ .face span{-webkit-backface-visibility:hidden;backface-visibility:hidden}
.face.front{background:rgba(88,166,255,.08);transform:translateZ(calc(var(--cube)/2))}
.face.back{background:rgba(88,166,255,.06);transform:rotateY(180deg) translateZ(calc(var(--cube)/2))}
.face.left{background:rgba(88,166,255,.04);transform:rotateY(-90deg) translateZ(calc(var(--cube)/2))}
@@ -72,12 +74,12 @@
<div class="obj-panel">
<div class="obj-wrap" id="obj-wrap" role="img" aria-label="A cube with its six faces labelled front, back, left, right, top and bottom">
<div class="cube">
- <div class="face front">FRONT</div>
- <div class="face back">BACK</div>
- <div class="face left">LEFT</div>
- <div class="face right">RIGHT</div>
- <div class="face top">TOP</div>
- <div class="face bottom">BOTTOM</div>
+ <div class="face front"><span>FRONT</span></div>
+ <div class="face back"><span>BACK</span></div>
+ <div class="face left"><span>LEFT</span></div>
+ <div class="face right"><span>RIGHT</span></div>
+ <div class="face top"><span>TOP</span></div>
+ <div class="face bottom"><span>BOTTOM</span></div>
</div>
</div>
</div>
diff --git a/docs/superpowers/plans/2026-09-29-3d-content.md b/docs/superpowers/plans/2026-09-29-3d-content.md
index 0d55d228..e80e7493 100644
--- a/docs/superpowers/plans/2026-09-29-3d-content.md
+++ b/docs/superpowers/plans/2026-09-29-3d-content.md
@@ -222,11 +222,11 @@ Canvas Particle Effect's cost is its links: one `stroke()` per line, thousands a
- `render()` loses the Rotation X, Rotation Y and Scale readouts.
- `applyRotation()` loses the chapter dots, name and description.
- **Reduced motion:** the page's own `reduceMotion` check stays: under reduced motion the cube follows the scroll exactly, with no gliding. The shared script scrolls nothing by itself, and Play still works. The rule `.obj-wrap{transition:none!important}` stays; `.prog-fill`'s goes with the bar.
-- **Stage font:** site font. The face labels keep 11px, 1px letter spacing and their blue; "BOT" becomes "BOTTOM".
+- **Stage font:** site font. The face labels keep 11px, 1px letter spacing and their blue; "BOT" becomes "BOTTOM". Each label sits in a `span` inside its face, and the span hides when the face turns away (`backface-visibility:hidden`, with `transform-style:preserve-3d` on the face). The faces are see-through, so without that each label shows, mirrored, behind the one in front of it, and "LEFT" over a reversed "RIGHT" cannot be read at the side pose.
- **Stage:**
- `.scroll-content` becomes `height:400%` and `.sticky-wrap` `height:25%` (a quarter of the content is one stage height, the pinned frame), in place of the `--stage-h` sums. Checked: on a phone stage the content is 1,192px and the pinned frame 298px, the stage's inner height.
- The info panel (Progress, Chapter dots, Stage name and its description) and the progress bar at the top go, so `.obj-panel` fills the frame and centres the cube. The cube is 120px and up to 168px while grown, which fits the 300px phone stage.
- - `hb-dots`: yes. Default height.
+ - `hb-dots`: yes. Default height. The stage sets `color-scheme:dark`, so a classic scroll bar (Windows draws a 15px one that stays visible) is dark, not a light grey bar on the dark stage.
- **Phone fallback:** none needed: one CSS cube of six faces.
- **Touch:** touch scrolling inside the stage works as it does today.