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: pressing the chosen Shape on 3D Model Orbit no longer resets its tilt, and its README names the model-view matrix

matin10a08622ac45
diff --git a/animations/06-3d-advanced/3d-model-orbit/README.md b/animations/06-3d-advanced/3d-model-orbit/README.md
index b5afda1a..5f7e841d 100644
--- a/animations/06-3d-advanced/3d-model-orbit/README.md
+++ b/animations/06-3d-advanced/3d-model-orbit/README.md
@@ -16,7 +16,7 @@ A WebGL program needs three components: geometry (vertex data), shaders (GPU pro
```glsl
attribute vec3 aPos, aNorm;
-uniform mat4 uMVP, uM; /* model-view-projection, model */
+uniform mat4 uMVP, uM; /* model-view-projection, model-view */
varying vec3 vN, vP;
void main() {
diff --git a/animations/06-3d-advanced/3d-model-orbit/index.html b/animations/06-3d-advanced/3d-model-orbit/index.html
index 09d7233f..8405c05c 100644
--- a/animations/06-3d-advanced/3d-model-orbit/index.html
+++ b/animations/06-3d-advanced/3d-model-orbit/index.html
@@ -267,7 +267,7 @@ const slowTog=document.getElementById('slow-tog');
let W,H,gl,prog,posBuf,nrmBuf,idxBuf,lineBuf,idxCount,lineCount;
const TILT=.3; // the forward tilt it starts with, and returns to when the shape changes: at 0 a ring is seen edge-on
let raf=null,paused=false,last=null,clock=0,rx=TILT,ry=0;
-let MODE='orbit',WIRE=false,DIST=3,SX=.2,SY=.8,COLOR=[88/255,166/255,255/255];
+let MODE='orbit',SHAPE='cube',WIRE=false,DIST=3,SX=.2,SY=.8,COLOR=[88/255,166/255,255/255];
let rollSpeed=.2,tumbles=true;
let mouseNX=0,mouseNY=0;
@@ -385,7 +385,7 @@ function choices(id,pick){
}
const speedSetting=document.getElementById('speed-setting'),tumbleSetting=document.getElementById('tumble-setting');
function setRoll(){SX=tumbles?rollSpeed:0;}
-choices('shape-seg',d=>{if(!gl)return;loadGeometry(d.shape);rx=TILT;ry=0;redraw();});
+choices('shape-seg',d=>{if(!gl||d.shape===SHAPE)return;SHAPE=d.shape;loadGeometry(SHAPE);rx=TILT;ry=0;redraw();});
// Speed and Tumbles only matter while it spins
choices('move-seg',d=>{MODE=d.mode;speedSetting.hidden=tumbleSetting.hidden=MODE!=='orbit';});
choices('speed-seg',d=>{SY=+d.sy;rollSpeed=+d.sx;setRoll();});
diff --git a/docs/superpowers/plans/2026-09-29-3d-content.md b/docs/superpowers/plans/2026-09-29-3d-content.md
index e80e7493..2378fc05 100644
--- a/docs/superpowers/plans/2026-09-29-3d-content.md
+++ b/docs/superpowers/plans/2026-09-29-3d-content.md
@@ -155,7 +155,7 @@ Canvas Particle Effect's cost is its links: one `stroke()` per line, thousands a
| Setting | Control | Choices or range (value shown) | Default | Hint | Sets in the demo |
|---|---|---|---|---|---|
-| Shape | Choice buttons | Cube · Sphere · Ring · Pyramid | Cube | The object that is drawn and lit. | `loadGeometry('cube' / 'sphere' / 'torus' / 'tetra')`, then `rx = .3` (the tilt it starts with) and `ry = 0`, so a ring opens up instead of showing edge-on and the shapes turn visibly (a plain sphere looks much the same from every side); today's menu handler set both to 0 |
+| Shape | Choice buttons | Cube · Sphere · Ring · Pyramid | Cube | The object that is drawn and lit. | `loadGeometry('cube' / 'sphere' / 'torus' / 'tetra')`, then `rx = .3` (the tilt it starts with) and `ry = 0`, so a ring opens up instead of showing edge-on and the shapes turn visibly (a plain sphere looks much the same from every side); today's menu handler set both to 0; pressing the shape that is already chosen does nothing (it would reset the tilt and turn) |
| Movement | Choice buttons | Spins · Follows the pointer | Spins | Or it turns to face your pointer or finger. | `MODE`: `'orbit'` / `'mouse'`; also shows Speed and Tumbles as it spins only with Spins |
| Speed | Choice buttons; shown only when Movement is Spins | Slow · Normal · Fast | Normal | How fast it spins. | `SY`: 0.5 / 0.8 / 1.3 and `SX`: 0.12 / 0.2 / 0.32 (`SX` stays 0 while Tumbles as it spins is off) |
@@ -202,7 +202,7 @@ Canvas Particle Effect's cost is its links: one `stroke()` per line, thousands a
- [Scroll-Driven 3D Rotation](../scroll-driven-3d-rotation/) — scrolling turns the object instead of time
- [Parallax 3D Tilt](../parallax-3d-tilt/) — a flat card leans in 3D toward the pointer
- [WebGL Shader Animation](../webgl-shader-animation/) — the same WebGL setup, painting a pattern instead of a shape
-- **README How it works:** unchanged, except the fragment shader's view vector line, which becomes `vec3 V = normalize(-vP);` as on the page (`vP` is already in camera space, so the camera is at the origin)
+- **README How it works:** unchanged, except the fragment shader's view vector line, which becomes `vec3 V = normalize(-vP);` as on the page (`vP` is already in camera space, so the camera is at the origin); and the vertex shader's uniform comment reads `/* model-view-projection, model-view */`, because `uM` holds the model-view matrix
- **README Production notes:** unchanged
- **Category line:** `06.01 · 3D & Advanced`
- **Pager:** Previous: none · Next: Scroll-Driven 3D Rotation (`../scroll-driven-3d-rotation/`)