{
  "schemaVersion": 1,
  "id": "donut-stack",
  "version": "1.0.1",
  "status": "published",
  "kind": "object",
  "title": "Donut Stack",
  "summary": "A tower of glazed donuts with wavy glossy frosting and sprinkles, turning and wobbling on a plate. Loops perfectly.",
  "description": "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.",
  "role": "Object (3D, three.js): a delicious, playful showpiece for food, bakery and treat content.",
  "collections": [
    "satisfying",
    "product-reveals"
  ],
  "tags": [
    "donut",
    "doughnut",
    "frosting",
    "sprinkles",
    "bakery",
    "food",
    "dessert",
    "sweet",
    "studio",
    "loop",
    "3d"
  ],
  "synonyms": [
    "doughnut stack",
    "glazed donuts",
    "frosted donuts",
    "pastry tower",
    "bakery",
    "sprinkle donut"
  ],
  "useCases": [
    "A bakery, café or dessert brand scene",
    "A food delivery or treat promo",
    "A cheerful product showcase backdrop"
  ],
  "featured": null,
  "publishedAt": "2026-10-08",
  "implementation": {
    "target": "three",
    "runtime": "browser",
    "language": "javascript",
    "module": "esm",
    "entry": "src/donut-stack.js",
    "exports": [
      {
        "name": "createDonutStack",
        "signature": "createDonutStack({ count?, flavours?, sprinkles?, seed? }) => { group, height, setProgress(progress), dispose() }",
        "description": "The tower of donuts on a plate, base on y = 0; needs an environment map."
      },
      {
        "name": "FLAVOURS",
        "signature": "FLAVOURS: { classic, pastel, berry }",
        "description": "Frosting colours in stacking order."
      }
    ],
    "reusable": [
      "src/donut-stack.js"
    ],
    "demo": "demo.js",
    "harness": "index.html"
  },
  "dependencies": [
    {
      "id": "three",
      "version": "0.185.1",
      "reason": "Renderer, geometry and shader materials."
    },
    {
      "id": "chrome-material",
      "version": "1.1.0",
      "scope": "demo",
      "reason": "Studio environment light, backdrop and contact shadow."
    },
    {
      "id": "apw-runtime",
      "version": "1.0.0",
      "scope": "demo",
      "reason": "Demo harness."
    }
  ],
  "params": [
    {
      "key": "count",
      "label": "Donuts",
      "type": "integer",
      "min": 2,
      "max": 8,
      "step": 1,
      "default": 5
    },
    {
      "key": "flavours",
      "label": "Frostings",
      "type": "select",
      "default": "classic",
      "options": [
        {
          "value": "classic",
          "label": "Classic"
        },
        {
          "value": "pastel",
          "label": "Pastel"
        },
        {
          "value": "berry",
          "label": "Berry"
        }
      ]
    },
    {
      "key": "sprinkles",
      "label": "Sprinkles",
      "type": "number",
      "min": 0,
      "max": 1,
      "step": 0.1,
      "default": 1
    },
    {
      "key": "seed",
      "label": "Seed",
      "type": "integer",
      "min": 1,
      "max": 999,
      "step": 1,
      "default": 4
    },
    {
      "key": "background",
      "label": "Backdrop",
      "type": "color",
      "default": "#2b2420"
    },
    {
      "key": "orbit",
      "label": "Camera sway",
      "type": "boolean",
      "default": true
    }
  ],
  "presets": [
    {
      "id": "default",
      "label": "Classic, five donuts",
      "params": {}
    },
    {
      "id": "pastel",
      "label": "Pastel, tall",
      "params": {
        "flavours": "pastel",
        "count": 7,
        "background": "#3a2f38",
        "seed": 9
      }
    },
    {
      "id": "berry",
      "label": "Berry, bare",
      "params": {
        "flavours": "berry",
        "sprinkles": 0,
        "count": 4,
        "background": "#1c1424"
      }
    },
    {
      "id": "mini",
      "label": "Two donuts",
      "params": {
        "count": 2,
        "seed": 21
      }
    }
  ],
  "output": {
    "width": 1080,
    "height": 1080,
    "fps": 30,
    "durationSeconds": 16,
    "posterSeconds": 4,
    "alpha": false,
    "motion": "procedural",
    "loop": {
      "seamless": true,
      "cycleSeconds": 16,
      "method": "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."
    },
    "seed": {
      "param": "seed",
      "behavior": "Seed shapes each donut's frosting edge, bake colour and sprinkle scatter: same seed, same tower."
    }
  },
  "composition": {
    "inputs": "Time within the loop; the count, frostings, sprinkles, seed, backdrop and camera sway.",
    "outputs": "A full frame rendered in 3D with a studio environment.",
    "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.",
    "compatibleWith": [
      "chrome-material",
      "orbit-camera",
      "kinetic-title",
      "number-reveal"
    ],
    "notes": [
      "Frosting is a generated strip over the top of each torus with a wavy border; sprinkles are one instanced capsule mesh per donut."
    ]
  },
  "reuse": [
    "Bakery promo: Classic, five donuts.",
    "Spring colours: Pastel, tall.",
    "Minimal: Two donuts."
  ],
  "integration": {
    "newProject": "Create a WebGLRenderer with a studio environment and a shadow-casting light, add createDonutStack().group and call tower.setProgress(progress) each frame.",
    "existingProject": "Copy src/donut-stack.js; add the group to your scene with an environment map."
  },
  "performance": {
    "notes": "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.",
    "limits": "Software WebGL renders in about a second a frame."
  },
  "limitations": [
    "Donuts do not collide: the tilt is small enough that neighbours touch lightly.",
    "Sprinkles are flat capsules without much shape variety."
  ],
  "license": {
    "spdx": "MIT",
    "notice": "Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder.",
    "thirdParty": []
  },
  "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.",
  "changelog": [
    {
      "version": "1.0.1",
      "date": "2026-10-08",
      "notes": "Instanced meshes are no longer culled using their first-frame bounds, so nothing can vanish when parts move far from where the first frame left them. No visual change."
    },
    {
      "version": "1.0.0",
      "date": "2026-10-05",
      "notes": "Initial release."
    }
  ]
}
