# Jelly Cube — `jelly-cube@1.0.0`

A translucent cube of jelly that hops, lands with a squash and wobbles itself still on a plate. Loops perfectly.

A cube of translucent jelly on a plate. It hops, stretching tall as it leaves the plate, lands with a deep squash and then wobbles itself still, its faces rippling in several octaves of travelling waves as the jelly shivers, glowing with the light that passes through it. Choose the flavour (strawberry, lime, grape or lemon), how many hops per loop, how much the jelly shivers, the mesh detail, the seed that sets the ripples, the backdrop colour and whether the camera sways.

- Kind: object; status: published; digest sha256:9e30956ba262b18c5e767bd0e94cf666b381922be30a27bac1800d77d6a62c74
- Role: Object (3D, three.js): a squishy, satisfying hero object for food, toys and playful content.
- Implementation: three; entry `src/jelly-cube.js`
- Files: https://aipixelwizard.com/registry/jelly-cube/1.0.0/<path> (`LICENSE`, `asset.json`, `demo.js`, `index.html`, `src/jelly-cube.js`)
- Manifest JSON: https://aipixelwizard.com/api/v1/visuals/jelly-cube/versions/1.0.0
- Runnable demo: https://aipixelwizard.com/registry/jelly-cube/1.0.0/index.html (open over http; it imports sibling packages by relative path)
- 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.

## Exports
- `createJellyCube({ flavour?, hops?, wobble?, detail?, seed? }) => { group, setProgress(progress), dispose() }` — The jelly cube on its plate, about 2 across and standing on y = 0; needs an environment map.
- `FLAVOURS: { strawberry, lime, grape, lemon }` — Jelly colours and opacities.

## Parameters
- `flavour` (select one of strawberry | lime | grape | lemon, default "strawberry") — Flavour
- `hops` (integer 1–4, default 2) — Hops per loop
- `wobble` (number 0.3–1.8, default 1) — Shiver
- `detail` (number 0.6–1.3, default 1) — Mesh detail
- `seed` (integer 1–999, default 12) — Seed
- `background` (color, default "#d8d0d8") — Backdrop
- `orbit` (boolean, default true) — Camera sway

## Composition
- Inputs: Time within the loop; the flavour, hops, shiver, detail, seed, backdrop and camera sway.
- Outputs: A full frame rendered in 3D with a studio environment.
- Coordinates: The jelly is a rounded cube 2 across sitting on a plate (radius 3.1) with its base on y = 0; it hops up to 2.6; the camera looks at y = 2.4.
- Lighting: A warm key light with a shadow map, a shadow-catching floor and the studio environment on the translucent jelly.
- Timing: setProgress(progress) rewrites the mesh each frame; frames render in any order.
- Works with: chrome-material, orbit-camera, kinetic-title, number-reveal
- About 3 700 vertices are rewritten each frame; the jelly keeps its volume as it squashes.

## Output and loop
- 1080×1080, 30 fps, 10 s, procedural
- Seamless loop: yes — Each hop takes a whole fraction of the loop, the ripples run whole cycles per loop, and the landing wobble has died away before the next hop begins, so the last frame meets the first.
- Verified 2026-10-06 in Chrome 154.0.8037.97 headless on Linux 7.0.0-38-generic (x64), Node 22.14.0 (WebGL 2 via SwiftShader (software)); deterministic: yes; loop check: Frame 0 vs end state (progress 1): mean |Δ| 0.0000, max |Δ| 0 of 255.

## Use it
New project: Create a WebGLRenderer with a studio environment and a shadow-casting light, add createJellyCube().group and call jelly.setProgress(progress) each frame.

Existing project: Copy src/jelly-cube.js; add the group to your scene with an environment map.

Reuse ideas:
- Dessert brand: Strawberry, two hops.
- Fresh: Lime, big shiver.
- Moody: Grape, dark.

## Limitations
- The jelly is translucent without true refraction or subsurface scattering.
- The wobble is a formula, not a soft-body simulation.

## License
MIT. Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder.

Provenance: Adapted from the owner's threejs-sketches/objects-scenes/jelly-cube (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original studio object: a rounded-cube mesh with three octaves of whole-cycle ripples, a closed-form hop, stretch and ringing squash that dies away before the next hop, on an exact loop.

