Skip to content

Donut Stack

A tower of glazed donuts with wavy glossy frosting and sprinkles, turning and wobbling on a plate. Loops perfectly.

3D object, V2 Objects3DSeamless loop, verified143 lines of codev1.0.0

In Food & sweets

Next: Chocolate PourSurprise me

Donut Stack preview
Starting live preview…
00:00:00:00 / 00:00:00:01

Live, running the real source at reduced resolution.

Your current settings go with it. Combine several clips and hand them over together from your sequence.

Effect controls

Presets

5
1
4

The preview runs the same code your AI receives. These settings travel with the hand-off.

Info

What it is

A tower of golden donuts on a white plate in warm studio light. Each donut has a wavy glossy frosting layer that thickens into a bead along its edge and a scatter of sprinkles, and the tower turns, sways and wobbles, neighbouring donuts turning in opposite directions. Choose how many donuts, the frosting flavours (classic, pastel or berry), how many sprinkles, the seed, the backdrop colour and whether the camera sways.

Reuse it in your own idea

  • Bakery promo: Classic, five donuts.
  • Spring colours: Pastel, tall.
  • Minimal: Two donuts.

Which part is reusable

src/donut-stack.js is the ingredient your AI reuses. demo.js is only the example scene around it, and uses chrome-material only for the demo.

Good to know

  • Donuts do not collide: the tilt is small enough that neighbours touch lightly.
  • Sprinkles are flat capsules without much shape variety.

Technical details

Technical details
Implementation
Three.js 0.185.1 (WebGL) · ES module src/donut-stack.js
Exports
  • createDonutStack({ count?, flavours?, sprinkles?, seed? }) => { group, height, setProgress(progress), dispose() }
  • FLAVOURS: { classic, pastel, berry }
Dependencies (exact)
  • three@0.185.1 (source) — Renderer, geometry and shader materials.
  • chrome-material@1.1.0 (demo) — Studio environment light, backdrop and contact shadow.
  • apw-runtime@1.0.0 (demo) — Demo harness.
How it fits a scene

Coordinates: The plate (radius 2.75) rests with its base at y = −0.32; the donuts stack from y ≈ 0.4 upward, centred on the y axis; the camera frames the whole tower.

Lighting: A warm key light with a shadow map and the studio environment.

Timing: setProgress(progress) sets every donut's turn, tilt and sway; frames render in any order.

Output
1080×1080, 30 fps, 16 s · procedural (computed from the frame number) · seamless loop — Each donut turns a whole number of times per loop (neighbours in opposite directions), tilts and sways in sines of whole cycles and the camera sway is a sine of the loop, so the last frame meets the first.
Tested
Rendered 480 frames on 2026-10-05 in Chrome 154.0.8037.97 headless on Linux 7.0.0-38-generic (x64), Node 22.14.0 (WebGL 2 via SwiftShader (software)). Same frame twice from fresh pages: identical. Loop: Frame 0 vs end state (progress 1): mean |Δ| 0.0000, max |Δ| 0 of 255.
Performance
Up to eight donuts of about 9 000 triangles each plus sprinkles and a shadow map: a couple of milliseconds a frame on an integrated Intel GPU. Software WebGL renders in about a second a frame.
Export a video yourself
Download the source, then in the folder: npm install npm run render -- donut-stack/1.0.0 --out my-video.mp4Needs Node 18+, ffmpeg and Chrome/Chromium. Add --params my-settings.json (from Copy settings) for your own settings.
Version
1.0.0 · sha256:e1256c606fcf17b5… · other versions: 1.0.1
Files
License
MIT. Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder. License details
Provenance
Adapted from the owner's threejs-sketches/objects-scenes/donut-stack (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original studio object: torus dough with vertex-colour baking, a generated wavy frosting strip with a bead edge, instanced sprinkles and a closed-form turn and wobble on an exact loop.
BinMore like this

Jelly Cube

3D object3DSeamless loop10 seconds