# Zest — a sparkling yuzu can that tumbles down the page and repaints it, flavour by flavour
> Paste this whole prompt as one message into a new, empty project.
## 1. Role and goal
You are a senior creative developer and art director. Build the complete one-page site of **Zest**, a sparkling yuzu drink in four flavours, in one pass and production-ready. The numbers below are the design: follow them exactly.
The page has one idea. A real-time 3D aluminium can, its label drawn in code, stands in the middle of the first screen in front of a giant wordmark. A full-screen liquid wipe (a shader) repaints everything at once (page, label, fruit, buttons) in the colours of another flavour. On scroll the same can travels down the page: it tumbles from section to section, spins with the scroll, is repainted three times inside a pinned flavour section, and lands in a cardboard tray beside three other cans. The can is also the control: tap it to pour the next flavour, tap a can in the tray to choose that one.
Tone: loud, flat, saturated colour; heavy ink-black display type; cream stickers with 2px ink outlines and hard offset shadows: a Showa-era citrus poster rebuilt as a modern drinks brand. Copy is dry and specific.
## 2. Stack and constraints
- Next.js (App Router) with TypeScript and Tailwind CSS v4 (`@import "tailwindcss";`, tokens in `@theme`).
- `three` with `@react-three/fiber` and `@react-three/drei` (drei is optional: the environment is built by hand, see 5.1), `gsap` with `ScrollTrigger`, `SplitText` and `CustomEase`, `lenis`, `lucide-react` for six icons (ArrowDown, ArrowUpRight, Check, Citrus, Minus, Plus).
- Fonts by name: **Dela Gothic One** (400), **DM Sans** (variable; 400, 500, 700 used), **DM Mono** (400, 500), Latin subset, loaded with `next/font` (or self-hosted `@fontsource` packages in a Vite project). Label, tray and giant word are painted on 2D canvases with these faces: wait for them (`document.fonts.load`, 1.5s at most) before mounting the scene.
- The scene is one client component loaded without server rendering (`next/dynamic`, `ssr: false`).
- **No external assets: every visual is generated in code.** Nothing is fetched from another host. Forbidden: drei `Environment` with `preset` or `files`, `useGLTF`, `useTexture` with a URL, drei `<Text>` without a local font file, any `<link>` or `@import` to a font or script host. Geometry comes from lathes, extrusions and primitives; textures from shaders or a 2D canvas.
- One page, no routes. Links are in-page anchors or buttons: no `target="_blank"`, no `alert`. Smooth scrolling is allowed; never hijack the scroll.
- No UI kit, no other animation library, no lorem ipsum.
- DOM animation touches `transform` and `opacity` only, with one exception: three colour custom properties on `:root` (`--pop`, `--accent`, `--deep`) are rewritten by script while a flavour changes. CSS transitions are for hover states only; everything driven by time or scroll is driven by script.
## 3. Design tokens
**Fixed colours.** `ink #14111F`: all text on flavour and cream bands, outlines, hard shadows, the giant word. `cream #FFF6E3`: text on deep bands, stickers, chips, the navigation pill, the cream band, the foot of the label, the tray. `aluminium #D9DCE2`: bare metal. `rule`: cream at 30 %, hairlines on deep bands.
**Flavours.** `pop` is the page colour of the flavour bands and the highlight colour on deep bands; `accent` is the colour of the can and of the primary buttons; `deep` is the colour of the dark bands; the last three colour the fruit.
| No. | Name | `pop` | `accent` | `deep` | rind | pith | flesh |
| --- | --- | --- | --- | --- | --- | --- | --- |
| 01 | Yuzu Original | `#FFD60A` | `#2238F5` | `#0B0F3A` | `#F2B100` | `#FFF7D2` | `#FFE873` |
| 02 | Blood Orange | `#FF5C28` | `#9B0E3F` | `#2A0612` | `#F04A12` | `#FFE6CC` | `#B9123A` |
| 03 | Shiso Lime | `#B4EE2B` | `#5A22C8` | `#1A0B3D` | `#3E9C1C` | `#F4FFD6` | `#D2F56E` |
| 04 | Pink Grapefruit | `#FF86A8` | `#006B4E` | `#04261C` | `#FFAE2B` | `#FFEEDD` | `#FF4772` |
Text on `accent` (`--on-accent`) is cream when the relative luminance of the accent is 0.36 or less, ink otherwise.
**Type.** Display: Dela Gothic One. Body: DM Sans. Labels: DM Mono.
- Giant word (hero, footer): one line fitted to its container (5.1, 5.9), line-height 0.8 to 0.86, tracking -0.03em.
- Flavour lockup: two lines, each fitted to the text column, capped at 25vh (13vh on phones), line-height 0.92, -0.03em.
- H2: `clamp(2rem, 1rem + 4.2vw, 4.75rem)`, line-height 1, -0.025em.
- Statement: `clamp(1.45rem, 0.7rem + 3.1vw, 3.6rem)`, 1.14, -0.02em.
- H1: `clamp(1.7rem, 1.05rem + 2vw, 2.75rem)`, 1.06, -0.02em.
- Numerals: figures `clamp(2.4rem, 1.3rem + 3.8vw, 5rem)`; price `clamp(2.8rem, 1.8rem + 3.6vw, 5rem)`; row numerals `clamp(1.9rem, 1.3rem + 1.9vw, 3.1rem)`; all line-height 1, -0.03em (price 0.01em). Units (`kcal`, `%`, `vol`) at 0.4em.
- Press quote: `clamp(1.4rem, 1rem + 2vw, 2.8rem)`, 1.1, -0.02em.
- Lead: DM Sans 500, `clamp(1.02rem, 0.94rem + 0.42vw, 1.28rem)`, 1.45. Body: DM Sans 400, `1rem`, 1.55. Buttons: DM Sans 700, `0.95rem` (small `0.85rem`, chips `0.875rem`).
- Label: DM Mono 500, `0.72rem`, 1.35, 0.09em, uppercase. Labels are written `01 / Why it tastes like that`: the slash is a `<b>` at 40 % opacity with 0.3em side margins.
- Headings use `text-wrap: balance`; leads and row descriptions use `text-wrap: pretty` (no one-word last lines).
**Space, radius, line.** Gutter `clamp(16px, 2.8vw, 40px)`; column gap `clamp(12px, 1.6vw, 24px)`; section padding about `clamp(120px, 19vh, 220px)` above and `clamp(90px, 14vh, 170px)` below. Pills (buttons, chips, navigation, fields, stepper) have radius 999px; the mobile menu sheet 24px; cards 28px; focus ring 8px. Outlines are 2px ink. Shadows are never blurred: a solid ink copy of the shape, 4px (navigation) or 5px (buttons, cards) lower.
**Easing vocabulary.**
- `out` = `cubic-bezier(0.16, 1, 0.3, 1)` (also a GSAP CustomEase): everything that arrives.
- `pop` = `cubic-bezier(0.34, 1.56, 0.64, 1)` in CSS, `back.out(1.3)` to `back.out(2)` in GSAP: stickers, chips, button faces, the can and the fruit landing.
- `inOut` = `power2.inOut` for a wipe played on the clock; the cubic `t < 0.5 ? 4t³ : 1 − (−2t + 2)³ / 2` for the horizontal track and programmatic scrolling.
- Scrubbed motion is linear in the scroll position; Lenis (`lerp: 0.11`) gives the inertia.
## 4. Layout
- One fixed, full-viewport WebGL canvas at `z-index: 0`, `pointer-events: none`. The page (`position: relative; z-index: 1; overflow-x: clip`) scrolls above it. **Sections have no background of their own**: the canvas paints the page. `html` is cream.
- The page is six colour bands painted by the canvas and joined by five liquid seams: hero (pop) · manifesto (deep) · flavours (pop) · inside (cream) · four-pack (pop) · stockists and footer (deep). Put an empty `<i data-seam>` (block, zero height) at each of the five boundaries; the scene reads their positions. Text is ink on pop and cream bands, cream on deep bands.
- Content: `max-width: 1560px`, centred, padded by the gutter, on a 12-column grid (`repeat(12, minmax(0, 1fr))`). Compositions are asymmetric on purpose: the can gets four or five columns to itself, alternating sides (centre, right, right, left, right).
- Six empty boxes tell the scene where things go: `div`s with `data-slot="word | hero | manifesto | flavours | inside | pack"`, `aria-hidden`, `pointer-events: none`, sized and placed by each section (5.3 to 5.7).
- Breakpoints: phone below 700px, medium 700 to 1023px, desktop from 1024px. Page length at 1440 x 900: about 9.8 screens.
## 5. Sections
### 5.1 The scene
**Canvas.** `dpr` clamped to `[1, 1.75]`; `antialias: true`, `alpha: false`, `stencil: false`; tone mapping `THREE.NeutralToneMapping` (it keeps the label colours true). Perspective camera, fov 30, at `(0, 0, 10)`, near 1, far 40, never moved: at z = 0 the viewport is 5.359 units high. The scene's pointer events listen on the page root (R3F `eventSource` = root element, `eventPrefix="client"`) because the DOM lies above the canvas. The loop stops (`frameloop="never"`) when the tab is hidden or the canvas is off screen.
**Draw order.** Backdrop (opaque, no depth test, `renderOrder -10`) → giant word (z = -2) → soft shadow (z = -1.3) → bubbles → can, fruit, leaves, four-pack (depth tested) → condensation. About 12 draw calls and 9,000 triangles on the first screen; 22 and 30,000 with the four-pack. No post-processing.
**The shared stage.** Page and scene share one mutable object, written by the scroll and flavour logic (6.2) and read every frame: `from` and `to` (flavour indices on either side of the liquid line; `from = -1` is the blank state of the intro), `p` (0 to 1: how far the liquid has risen), `scroll` (px), `vel` (scroll speed: `|Δscroll| / dt / 2600` clamped to 1, damped at rate 6), the pointer in viewport fractions with `pointerOn`, the intro channels `drop`, `spin`, `burst`, `dew` (0 to 1), `kick` (click impulse), `seams` (page y of the five seams), and `holds` (for each slot, the scroll range in which the can rests on it).
**The liquid wipe** is the heart of the scene: one GLSL function of the screen position, `wipeDist`, the signed distance to a wavy liquid surface that rises from below the screen (`p = 0`) to above it (`p = 1`), with four drops thrown ahead and melted into it by a smooth minimum. **Every material that has a flavour calls it**: the backdrop mixes two page colours, the label material two label textures, the fruit material two palettes, and the word is uncovered by it. So the whole frame repaints along one wobbling line, can included. Level, swell and drops are computed once per frame on the CPU.
**Backdrop.** Not a full-screen shader with every seam in it: three stacked bands of geometry whose shared edges are the two seams nearest to the viewport. Build it as three strips of 96 quads: for band `b` (0, 1, 2) and column `c` (0 to 96), two vertices with `aGrid = (c / 96, b)` and `(c / 96, b + 1)` and `aBand = b`. The vertex shader bends the two inner edges into waves of amplitude `9 + 46 · vel` px, so the seams slosh when the page moves. Each band carries what it is made of (pop, deep or cream). The fragment shader adds a sunburst of 14 pale rays centred on the projected can, on flavour bands only, and a pointer puddle: three metaballs (radii 0.075, 0.055, 0.04 of the screen height, each pulsing 8 %) trailing the pointer at damping rates 14, 6.5 and 3.6; `uPointer` rises at rate 8 while the pointer moves and falls at rate 5 once it has been still for 0.3s. The wipe, its foam band and the stripe it draws on the cream band are compiled only into a second program, used while `0.001 < p < 0.999`.
**Giant word.** The brand in capitals, Dela Gothic One at 200px with -4px tracking, white on a transparent canvas cropped to its ink bounds (width = viewport width x dpr, 3072 at most), used as an alpha mask on an ink plane at z = -2. Each frame the plane is fitted to the `word` slot: as wide as the slot unless that makes it taller than the slot. It shifts by `(0.5 − pointerX) · 0.14` units; during the intro it only shows under the liquid.
**The can.** Height 3.1, radius 0.62. Three lathes of 96 segments: the printed wall, whose `v` is rewritten from the height so the label is not stretched; the domed foot and rolled rim, merged with an extruded pull tab and its rivet into one bare-metal mesh (`MeshStandardMaterial`, `#D9DCE2`, metalness 1, roughness 0.26); a lid disc (metalness 1, roughness 0.34) textured by a 512px canvas of brushed concentric rings, three pressed rings, a scored oval opening and small print round the edge. The printed wall is a clearcoated `MeshPhysicalMaterial` patched to mix two labels along the liquid line; blank, it is bare aluminium.
- **Condensation**: 300 instanced quads (180 on phones) lying on the straight wall (y from -1.2 to 1.16), radius `0.011 + rand^3.2 · 0.04`, up to 1.5 times taller than wide. The fragment shader makes each a lens: discard outside the unit circle, build a sphere normal (z scaled 0.8), then white light = `pow(R·V, 70)` from a key at (-0.45, 0.75, 0.55) + `0.45 · pow(R·V, 36)` from (0.7, 0.15, 0.6) + a caustic away from the light (up to 0.30) + fresnel `0.30 · (1 − N·V)^2.2`, over a 22 % shade on the lit side; alpha = light + shade, softened at the rim. They scale in with `dew`.
- **Soft shadow**: an ink plane 2.9 x 4.1 can scales, 0.34 right and 0.36 below the can, alpha `0.3 · (1 − smoothstep(0, 1, r))²`.
**The label**: one 2048 x 1024 canvas per flavour (1024 x 512 on phones), sRGB, anisotropy 8, front panel in the middle (the lathe starts at φ = π, so the seam is at the back). Draw in units of 1316 x 1000 (circumference x printed height) by scaling the context. Four inks: accent, pop, cream, ink; `T` is the text colour on the accent. Strings are in the copy deck.
- All round: accent fill; a 3-unit hairline at y = 98; at y = 130 a ring of 15-unit mono text, repeated and stretched to close exactly; a cream foot below `y = 808 + 17 · sin(8πx / 1316)` with a 10-unit pop line riding 28 units above it; an accent band below y = 952.
- Front (x = 658): a citrus wheel of radius 190 at (770, 385): pop disc, cream ring at 87 % of the radius, ten flesh-coloured segments from 20 % to 72 % of the radius with 0.15 rad gaps, cream centre. The wordmark climbs the can: brand in capitals rotated -90°, starting at (505, 746), fitted to 586 units, 168 at most, colour T. Mono 16 lines at (598, 166) and (598, 622); under the second, the flavour name on two Dela lines (50 units at most, fitted to 330). On the foot, in ink: the product name in Dela (30 units, centred, y = 876) and a mono 14 line at y = 904.
- Left (x = 329): the flavour number in outline (Dela 168, 4-unit stroke), `TASTES` and the three notes in Dela 34, `GOES WITH` and the pairing in mono 15.
- Right (x = 987): three words in pop Dela 46 running down the can from y = 168; an 18-point pop seal at (1083, 640) with ink text.
- Back (x = 0 and 1316, drawn twice so it closes): a 300 x 344 outlined nutrition box with five rows, the ingredient list in mono 13.5 under it, and a barcode on the foot.
**Fruit and leaves.** Five citrus wheels: one `InstancedMesh` of a cylinder (radius 1, thickness 0.13, 48 segments), rind material on the side, face material on both caps. The face texture is a 512px **mask**, not a picture: red = flesh (nine wedges at value 236, each with 90 short radial strokes at 196 to 255: the juice sacs), green = pith and membranes, blue = rind; the shader colours it with the palettes of the two flavours. Three leaves: an instanced 10 x 1 plane bent into a shallow saddle, textured by a 256 x 128 canvas (leaf outline in alpha, gradient `#2A9B4A` to `#0F5F2A`, pale midrib and veins), `alphaTest 0.5`, double sided, roughness 0.55. All eight orbit the can in world space with the radii, heights, speeds and sizes of the reference code; their positions are damped (rate 5 to 8.5) so they trail the can like a comet tail; the pointer pushes them away within 1 unit; they scale in with `burst` and vanish between 45 % and 85 % of the last hop.
**Bubbles.** 80 points (44 on phones) over 11 units of width, z from -1.6 to 1.8, rising in a loop: `y = 3.4 · (2 · fract(t · (0.10 + 0.22 · speed) + phase − scroll · 0.00035 · (0.4 + size)) − 1)`, with a sideways wobble of 0.10. Each is a white ring with a glint, 6 to 22px, fading at both ends of its climb.
**Four-pack.** A group fitted to the `pack` slot (3.7 units high, 6.54 wide), rotated (0.13, -0.20, 0) (y = -0.12 on phones): a cream cardboard tray (base 5.6 x 0.08 x 1.5, front and sides 0.96 high, back 1.5 high, roughness 0.92) with a printed front (1024 x 256 canvas: cream with paper fibres, ink bands top and bottom, the brand fitted to 40 % of the width, two lines of text, diagonal ink stripes on the last 10 %), and four places 1.36 apart. The travelling can lands in the first; the three others carry the next flavours, `(flavour + j) % 4`, with the same wipe material, so the pack is repainted too. On the last hop (`g` = its progress) the tray rises 6 units with `smootherstep(0.02, 0.55, g)` and can j falls 9 units with `land((g − 0.2 − 0.08j) / 0.52)` (a quadratic fall, then one 3.5 % bounce) while tumbling `(1 − f) · (4 + j)` rad. Hovering a landed can lifts it 0.2 and turns it 0.5 rad.
**Light.** A grey room with six emissive panels baked once into `scene.environment` (reference code), plus an ambient light 0.5 and two directional lights: (-3.5, 5, 6) at 1.9 and (5, -1, 3) at 0.5.
**Slots and hops.** Every frame the scene reads the box of each slot and turns it into a pose. The can rests on a slot while the scroll is inside that slot's hold: hero `[0, 0]`; manifesto and inside `[c − 0.12vh, c + 0.12vh]`, `c` being the scroll at which the slot is centred in the viewport; flavours = the whole pinned range; pack `[c, c]`. Between two holds it hops: it interpolates the **current** screen positions of the two slots (so it stays in view), is thrown 0.9 units toward the camera and makes one end-over-end tumble. It spins by itself (0.35 rad/s) and with the scroll (0.006 rad per px), and lands facing front.
**Pointer.** Swiping across the can spins it; it leans toward the pointer; the fruit is pushed away; the puddle follows. A click on the can (an invisible 12-sided cylinder carries the handlers; clicks landing on a link, button or input are ignored) pours the next flavour and kicks the spin by 9 rad/s with a 7 % scale pulse. Clicking a can of the tray selects its flavour.
#### Reference code
Use this code as written; adapt only imports and file layout to the project. It holds the wipe and backdrop shaders, the can, the studio, the flavour materials and the frame loop. The 2D painters and the small shaders of the word, the condensation, the bubbles and the shadow follow the description above. `stage` is the shared object; `FLAVOURS` is the table of section 3; `SLOT_NAMES` is `["hero", "manifesto", "flavours", "inside", "pack"]`.
```ts
export const WIPE = /* glsl */ `
uniform vec2 uRes; // drawing buffer, px
uniform float uTime;
uniform float uWipe; // 0: all old flavour, 1: all new flavour
uniform vec2 uLevel; // x: height of the liquid surface in screen heights, y: swell of its waves
uniform vec3 uDrops[4]; // drops thrown ahead of the surface: xy centre (x in aspect units), z radius
float smin(float a, float b, float k) {
float h = clamp(0.5 + 0.5 * (b - a) / k, 0.0, 1.0);
return mix(b, a, h) - k * h * (1.0 - h);
}
// signed distance to the liquid surface, in screen heights: negative is under the liquid
float wipeDist(vec2 frag) {
vec2 uv = frag / uRes;
float d = uv.y - uLevel.x;
if (abs(d) > 0.34) return d; // far from the surface: no waves, no drops
float x = uv.x * uRes.x / uRes.y;
d -= uLevel.y * (
0.050 * sin(x * 3.1 + uTime * 2.3 + uWipe * 5.0) +
0.022 * sin(x * 7.3 - uTime * 3.1) +
0.010 * sin(x * 15.0 + uTime * 5.2));
vec2 p = vec2(x, uv.y);
d = smin(d, length(p - uDrops[0].xy) - uDrops[0].z, 0.07);
d = smin(d, length(p - uDrops[1].xy) - uDrops[1].z, 0.07);
d = smin(d, length(p - uDrops[2].xy) - uDrops[2].z, 0.07);
d = smin(d, length(p - uDrops[3].xy) - uDrops[3].z, 0.07);
return d;
}
float wipeMask(vec2 frag) {
if (uWipe <= 0.001) return 0.0;
if (uWipe >= 0.999) return 1.0;
float aa = 1.5 / uRes.y;
return 1.0 - smoothstep(-aa, aa, wipeDist(frag));
}
`;
/**
* The backdrop is three bands of the page stacked in screen space. Their shared edges are the liquid
* seams: the vertex shader bends them, so the fragment shader pays nothing for them.
*/
export const BACKDROP_VERT = /* glsl */ `
attribute vec2 aGrid; // x: 0..1 across the screen, y: which edge (0 top, 1 seam A, 2 seam B, 3 bottom)
attribute float aBand; // 0 above seam A, 1 between, 2 below seam B
uniform vec2 uRes;
uniform float uTime;
uniform float uDpr;
uniform float uVel; // 0..1, how fast the page scrolls
uniform vec4 uSeam; // x: seam A in css px from the top of the viewport, y: its phase, z and w: seam B
uniform vec3 uBand[3]; // what each band is made of: x flavour colour, y deep colour, z cream
varying vec3 vBand;
float wave(float xpx, float ph) {
return sin(xpx * 0.0052 + uTime * 1.25 + ph * 2.3) + 0.45 * sin(xpx * 0.0127 - uTime * 1.9 + ph * 4.1);
}
void main() {
float h = uRes.y / uDpr;
float xpx = aGrid.x * uRes.x / uDpr;
float amp = 9.0 + 46.0 * uVel;
float y = -h - 400.0;
if (aGrid.y > 2.5) y = 2.0 * h + 400.0;
else if (aGrid.y > 1.5) y = uSeam.z + amp * wave(xpx, uSeam.w);
else if (aGrid.y > 0.5) y = uSeam.x + amp * wave(xpx, uSeam.y);
vBand = uBand[int(aBand + 0.5)];
gl_Position = vec4(aGrid.x * 2.0 - 1.0, 1.0 - 2.0 * y / h, 1.0, 1.0);
}
`;
/** compiled twice: as is for the resting page, and with LIVE defined while a wipe is crossing the screen */
export const BACKDROP_FRAG = /* glsl */ `
${WIPE}
uniform vec3 uPopA; // flavour colour above the liquid line
uniform vec3 uPopB; // flavour colour below it
uniform vec3 uDeepA;
uniform vec3 uDeepB;
uniform vec3 uCream;
uniform vec2 uCan; // centre of the can, 0..1
uniform float uRays; // strength of the sunburst
uniform vec3 uTrail[3]; // pointer puddle: xy 0..1, z radius
uniform float uPointer;
varying vec3 vBand;
// cheap atan2, good to 0.0002 rad
float angle(vec2 v) {
vec2 a = abs(v);
float t = min(a.x, a.y) / (max(a.x, a.y) + 1e-6);
float s = t * t;
float r = ((-0.0464964749 * s + 0.15931422) * s - 0.327622764) * s * t + t;
if (a.y > a.x) r = 1.57079637 - r;
if (v.x < 0.0) r = 3.14159274 - r;
return v.y < 0.0 ? -r : r;
}
void main() {
vec2 uv = gl_FragCoord.xy / uRes;
float asp = uRes.x / uRes.y;
#ifdef LIVE
float d = wipeDist(gl_FragCoord.xy);
float m = 1.0 - smoothstep(-1.5 / uRes.y, 1.5 / uRes.y, d);
#else
float m = step(0.5, uWipe);
#endif
vec3 pop = mix(uPopA, uPopB, m);
vec3 deep = mix(uDeepA, uDeepB, m);
// sunburst behind the can: fourteen pale rays, only where the band is the flavour colour
vec2 q = vec2((uv.x - uCan.x) * asp, uv.y - uCan.y);
float rr = length(q);
float fall = smoothstep(0.10, 0.30, rr) * (1.0 - smoothstep(0.45, 1.25, rr));
float w = abs(fract(angle(q) * 2.228169 + uTime * 0.016) - 0.5);
float aaA = 3.4 / (uRes.y * max(rr, 0.02));
float ray = smoothstep(0.25 - aaA, 0.25 + aaA, w) * fall * uRays;
vec3 col = vBand.x * mix(pop, vec3(1.0), 0.17 * ray) + vBand.y * deep + vBand.z * uCream;
#ifdef LIVE
// on the cream band the new flavour passes as a stripe under the surface
float stripe = smoothstep(-0.085, -0.075, d) * (1.0 - smoothstep(-0.034, -0.026, d));
col = mix(col, uPopB, stripe * vBand.z);
// foam: a pale band just under the liquid surface
col = mix(col, vec3(1.0), 0.6 * (1.0 - smoothstep(0.008, 0.012, abs(d + 0.013))));
#endif
// pointer puddle: three metaballs that trail the pointer
float f = 0.0;
for (int i = 0; i < 3; i++) {
vec2 dq = vec2((uv.x - uTrail[i].x) * asp, uv.y - uTrail[i].y);
f += uTrail[i].z * uTrail[i].z / (dot(dq, dq) + 1e-5);
}
float puddle = smoothstep(0.965, 1.035, f) * uPointer * uPointer;
col = mix(col, vec3(1.0), 0.20 * puddle * vBand.x);
col = mix(col, pop, puddle * (0.16 * vBand.y + 0.40 * vBand.z));
gl_FragColor = vec4(col, 1.0);
#include <colorspace_fragment>
}
`;
```
```tsx
const FOV = 30;
const CAM_Z = 10;
/** world height of the viewport at z = 0 */
const VIEW_H = 2 * Math.tan((FOV * Math.PI) / 360) * CAM_Z;
const CAN_H = 3.1;
const CAN_R = 0.62;
const PITCH = 1.36; // distance between two cans in the tray
const WORD_Z = -2;
/** uniforms shared by every material that takes part in the wipe */
const U = {
uRes: { value: new THREE.Vector2(1, 1) },
uTime: { value: 0 },
uWipe: { value: 0 },
uLevel: { value: new THREE.Vector2(-0.32, 0.55) },
uDrops: { value: [0, 1, 2, 3].map(() => new THREE.Vector3(0, -9, 0.02)) },
};
const clamp = (v: number, a = 0, b = 1) => Math.min(b, Math.max(a, v));
const lerp = (a: number, b: number, t: number) => a + (b - a) * t;
const smooth = (a: number, b: number, v: number) => {
const t = clamp((v - a) / (b - a));
return t * t * t * (t * (t * 6 - 15) + 10);
};
const damp = (rate: number, dt: number) => 1 - Math.exp(-rate * dt);
/** a fall under gravity, then one small bounce */
const land = (x: number) => (x < 0.72 ? (x / 0.72) ** 2 : 1 - 0.035 * Math.sin(((x - 0.72) / 0.28) * Math.PI));
function buildCan() {
const profile = (pts: number[][]) => pts.map(([x, y]) => new THREE.Vector2(x, y));
const lathe = (pts: number[][]) => new THREE.LatheGeometry(profile(pts), 96, Math.PI, Math.PI * 2);
// printed wall: chamfer, straight wall, shoulder, neck. v follows the height so that the label is not stretched
const body = lathe([[0.52, -1.49], [0.555, -1.455], [0.585, -1.405], [0.607, -1.34], [0.62, -1.26], [0.62, 1.2], [0.614, 1.27], [0.596, 1.335], [0.567, 1.39], [0.54, 1.435], [0.525, 1.47]]);
const pos = body.attributes.position;
for (let i = 0; i < pos.count; i++) body.attributes.uv.setY(i, (pos.getY(i) + 1.49) / 2.96);
// bare aluminium: the domed foot, the rolled rim, the tab and its rivet, merged into one draw call
const foot = lathe([[0, -1.43], [0.2, -1.445], [0.36, -1.49], [0.43, -1.535], [0.455, -1.55], [0.48, -1.54], [0.505, -1.515], [0.52, -1.49]]);
const rim = lathe([[0.525, 1.47], [0.533, 1.487], [0.547, 1.5], [0.553, 1.52], [0.547, 1.542], [0.532, 1.55], [0.515, 1.545], [0.506, 1.53], [0.5, 1.505], [0.497, 1.49]]);
const s = new THREE.Shape();
const [x0, y0, x1, y1, r] = [-0.105, -0.075, 0.105, 0.3, 0.09];
s.moveTo(x0 + r, y0);
s.lineTo(x1 - r, y0);
s.absarc(x1 - r, y0 + r, r, -Math.PI / 2, 0, false);
s.lineTo(x1, y1 - r);
s.absarc(x1 - r, y1 - r, r, 0, Math.PI / 2, false);
s.lineTo(x0 + r, y1);
s.absarc(x0 + r, y1 - r, r, Math.PI / 2, Math.PI, false);
s.lineTo(x0, y0 + r);
s.absarc(x0 + r, y0 + r, r, Math.PI, Math.PI * 1.5, false);
const hole = new THREE.Path();
hole.absellipse(0, 0.19, 0.055, 0.07, 0, Math.PI * 2, true, 0);
s.holes.push(hole);
const tab = new THREE.ExtrudeGeometry(s, { depth: 0.012, bevelEnabled: true, bevelSize: 0.006, bevelThickness: 0.005, bevelSegments: 2, curveSegments: 14 });
tab.rotateX(-Math.PI / 2);
tab.translate(0, 1.498, 0);
const rivet = new THREE.CylinderGeometry(0.036, 0.044, 0.024, 20);
rivet.translate(0, 1.518, 0);
const metal = mergeGeometries([foot.toNonIndexed(), rim.toNonIndexed(), tab, rivet.toNonIndexed()])!;
const lid = new THREE.CircleGeometry(0.497, 64);
lid.rotateX(-Math.PI / 2);
lid.translate(0, 1.49, 0);
return { body, metal, lid };
}
/**
* Studio lighting, built in code: a grey room with six light panels (two tall strips for the streaks on
* the can, a top and a warm floor, a round front fill, a back wall), baked once into the scene environment.
*/
function buildStudio(gl: THREE.WebGLRenderer) {
const room = new THREE.Scene();
room.background = new THREE.Color("#6f7178");
const panel = (w: number, h: number, at: [number, number, number], intensity: number, colour = "#ffffff", round = false) => {
const mesh = new THREE.Mesh(
round ? new THREE.CircleGeometry(0.5, 32) : new THREE.PlaneGeometry(1, 1),
new THREE.MeshBasicMaterial({ color: new THREE.Color(colour).multiplyScalar(intensity), side: THREE.DoubleSide, toneMapped: false }),
);
mesh.scale.set(w, h, 1);
mesh.position.set(...at);
mesh.lookAt(0, 0, 0);
room.add(mesh);
};
panel(1.6, 10, [-5, 2, 4], 7);
panel(0.8, 10, [5.5, 1, 2.5], 3.2);
panel(9, 5, [0, 7, 1], 2.2);
panel(9, 5, [0, -7, 2], 1.1, "#fff1c8");
panel(2.6, 2.6, [1.5, 0.5, 8], 2.4, "#ffffff", true);
panel(8, 6, [-2, 1, -7], 1.6);
const pmrem = new THREE.PMREMGenerator(gl);
const target = pmrem.fromScene(room, 0, 0.1, 40);
pmrem.dispose();
return target;
}
/** printed wall of a can: two labels, mixed along the liquid line; under the blank state it is bare aluminium */
function labelMaterial(tex: THREE.Texture) {
const u = { uMapFrom: { value: tex }, uMapTo: { value: tex }, uFromBlank: { value: 0 } };
const m = new THREE.MeshPhysicalMaterial({ map: tex, metalness: 0.3, roughness: 0.4, clearcoat: 1, clearcoatRoughness: 0.14 });
m.onBeforeCompile = (shader) => {
Object.assign(shader.uniforms, u, U);
shader.fragmentShader = shader.fragmentShader
.replace("#include <common>", `#include <common>\n${WIPE}\nuniform sampler2D uMapFrom;\nuniform sampler2D uMapTo;\nuniform float uFromBlank;`)
.replace(
"#include <map_fragment>",
`float zWipe = wipeMask(gl_FragCoord.xy);
vec4 tFrom = texture2D(uMapFrom, vMapUv);
vec4 tTo = texture2D(uMapTo, vMapUv);
tFrom.rgb = mix(tFrom.rgb, vec3(0.80, 0.82, 0.86), uFromBlank);
diffuseColor *= mix(tFrom, tTo, zWipe);
float zBare = uFromBlank * (1.0 - zWipe);`,
)
.replace("#include <roughnessmap_fragment>", "float roughnessFactor = mix(roughness, 0.28, zBare);")
.replace("#include <metalnessmap_fragment>", "float metalnessFactor = mix(metalness, 1.0, zBare);");
};
m.customProgramCacheKey = () => "zest-label";
return { m, u };
}
/** citrus wheel: the mask texture is coloured with the palettes of the two flavours on either side of the liquid line */
function fruitMaterials(data: THREE.Texture) {
const col = () => ({ value: new THREE.Color() });
const u = { uFleshA: col(), uFleshB: col(), uPithA: col(), uPithB: col(), uRindA: col(), uRindB: col() };
const decl = `#include <common>\n${WIPE}\nuniform vec3 uFleshA; uniform vec3 uFleshB; uniform vec3 uPithA; uniform vec3 uPithB; uniform vec3 uRindA; uniform vec3 uRindB;`;
const face = new THREE.MeshPhysicalMaterial({ map: data, roughness: 0.32, clearcoat: 0.8, clearcoatRoughness: 0.2 });
face.onBeforeCompile = (shader) => {
Object.assign(shader.uniforms, u, U);
shader.fragmentShader = shader.fragmentShader
.replace("#include <common>", decl)
.replace(
"#include <map_fragment>",
`vec3 mk = texture2D(map, vMapUv).rgb;
float wm = wipeMask(gl_FragCoord.xy);
diffuseColor.rgb = mix(uFleshA, uFleshB, wm) * mk.r + mix(uPithA, uPithB, wm) * mk.g + mix(uRindA, uRindB, wm) * mk.b;`,
)
.replace("#include <emissivemap_fragment>", "totalEmissiveRadiance = diffuseColor.rgb * 0.3;");
};
face.customProgramCacheKey = () => "zest-fruit-face";
const rind = new THREE.MeshStandardMaterial({ roughness: 0.5 });
rind.onBeforeCompile = (shader) => {
Object.assign(shader.uniforms, u, U);
shader.fragmentShader = shader.fragmentShader
.replace("#include <common>", decl)
.replace("#include <color_fragment>", "diffuseColor.rgb = mix(uRindA, uRindB, wipeMask(gl_FragCoord.xy));")
.replace("#include <emissivemap_fragment>", "totalEmissiveRadiance = diffuseColor.rgb * 0.18;");
};
rind.customProgramCacheKey = () => "zest-fruit-rind";
return { face, rind, u };
}
// ---------- orbits, resting tilts, bands ----------
const SLICES = [
{ r: 1.42, y: 1.0, inc: 0.3, w: 0.42, ph: 0.55, size: 0.5, spin: [0.5, 0.31] },
{ r: 1.86, y: -0.5, inc: -0.2, w: 0.31, ph: 2.05, size: 0.6, spin: [-0.36, 0.44] },
{ r: 1.3, y: -1.2, inc: 0.16, w: 0.5, ph: 3.25, size: 0.4, spin: [0.62, -0.27] },
{ r: 2.05, y: 0.42, inc: 0.12, w: 0.26, ph: 4.45, size: 0.47, spin: [-0.45, -0.38] },
{ r: 1.6, y: 1.42, inc: -0.3, w: 0.36, ph: 5.7, size: 0.36, spin: [0.4, 0.52] },
];
const LEAVES = [
{ r: 1.12, y: 1.6, inc: 0.2, w: -0.46, ph: 1.2, size: 0.5, spin: [0.3, 0.2] },
{ r: 1.45, y: -1.2, inc: -0.15, w: -0.33, ph: 2.6, size: 0.58, spin: [-0.25, 0.3] },
{ r: 1.7, y: 0.6, inc: 0.25, w: -0.24, ph: 5.3, size: 0.44, spin: [0.2, -0.3] },
];
/** resting tilt of the can on each slot (x, z) and the number of end-over-end turns on the way to the next one */
const TILT: [number, number][] = [[0.1, -0.17], [0.3, 0.42], [0.05, 0.1], [0.12, -0.13], [0, 0]];
const TURNS = [1, -1, 1, 1];
const ORBITERS = [...SLICES, ...LEAVES];
/** the six bands of the page, top to bottom: 0 flavour colour, 1 deep colour, 2 cream */
const BANDS = [0, 1, 0, 2, 0, 1];
// ---------- the frame loop, inside the scene component ----------
// refs: can, pack, tray (groups), packCans (4 groups), backdrop (mesh). mat, tex, built: the materials, canvas textures and instanced
// meshes described above; bu = the uniforms shared by mat.backdrop and mat.backdropLive (same shaders, the second with the define LIVE).
// Pose = { x, y, z, s }. phone = viewport narrower than 700px. tmp: scratch { qA, qB, q: Quaternion, e: Euler, v, v2, s: Vector3, m: Matrix4, X, Y, Z: unit axes }.
// sim: { time: 0, yaw: -1.13, flick: 0, pulse: 0, lastScroll: -1, lastPx: 0.5, leanX: 0, leanZ: 0, hover: -1, lift: [0, 0, 0, 0],
// packYaw: [0, 0, 0, 0], started: false, orbit: ORBITERS.map((o) => ({ a: o.ph, p: new Vector3(), push: new Vector3() })), els: {} }
useFrame((_, delta) => {
if (!can.current || !pack.current || !tray.current) return;
const dt = Math.min(delta, 0.1);
const still = stage.reduced;
if (!still) sim.time += dt;
const t = sim.time;
const vw = size.width;
const vh = size.height;
const k = VIEW_H / vh; // world units per css px at z = 0
gl.getDrawingBufferSize(U.uRes.value);
U.uTime.value = t;
U.uWipe.value = stage.p;
// the liquid surface and the four drops it throws ahead of itself
const level = lerp(-0.32, 1.3, stage.p);
U.uLevel.value.set(level, 0.55 + 0.9 * Math.sin(Math.PI * stage.p));
U.uDrops.value.forEach((drop, n) => drop.set((vw / vh) * ((0.13 + n * 0.277) % 1), level + 0.075 + 0.05 * Math.sin(t * 2.6 + n * 2.1) + 0.012 * n, 0.02 + 0.012 * ((n * 0.618) % 1)));
// ... here the palettes of the two flavours (pop, deep, rind, pith, flesh) and the two label textures of each can are copied
// into the uniforms: a = max(stage.from, 0), b = stage.to, blank = stage.from < 0; can j of the pack shows (a + j) % 4 and (b + j) % 4 ...
/* ---- where the DOM wants things ---- */
const els = sim.els;
for (const name of [...SLOT_NAMES, "word"]) if (!els[name] || !els[name]!.isConnected) els[name] = document.querySelector<HTMLElement>(`[data-slot="${name}"]`);
const rectPose = (el: HTMLElement | null, unit: number, wide: number): Pose => {
if (!el) return { x: 0, y: 0, z: 0, s: 1 };
const r = el.getBoundingClientRect();
return { x: (r.left + r.width / 2 - vw / 2) * k, y: (vh / 2 - (r.top + r.height / 2)) * k, z: 0, s: Math.min((r.height * k) / unit, (r.width * k) / wide) };
};
// the four-pack sits on its slot and scrolls with the page
const pk = rectPose(els.pack, 3.7, PITCH * 4 + 1.1);
pack.current.position.set(pk.x, pk.y, 0);
pack.current.scale.setScalar(pk.s);
pack.current.rotation.set(0.13, phone ? -0.12 : -0.2, 0);
pack.current.updateMatrixWorld();
/* ---- which hop the can is on ---- */
const sc = stage.scroll;
const holds = stage.holds;
let i = 0;
let u = 0;
if (!still) {
while (i < 4 && sc >= holds[i + 1][0]) i++;
if (i === 4) {
i = 3;
u = 1;
} else if (sc > holds[i][1]) u = clamp((sc - holds[i][1]) / Math.max(1, holds[i + 1][0] - holds[i][1]));
}
const e = smooth(0.08, 0.92, u);
const packT = i === 3 ? u : 0; // progress of the last hop: the four-pack assembles on it
const packK = i === 3 ? smooth(0.5, 0.95, u) : 0;
const A = rectPose(els[SLOT_NAMES[i]], CAN_H, CAN_R * 2 * 1.5);
let B: Pose;
tmp.qA.setFromEuler(tmp.e.set(TILT[i][0], 0, TILT[i][1], "ZXY"));
if (i === 3) {
tmp.v.set(-1.5 * PITCH, 0, 0).applyMatrix4(pack.current.matrixWorld);
B = { x: tmp.v.x, y: tmp.v.y, z: tmp.v.z, s: pk.s };
tmp.qB.copy(pack.current.quaternion);
} else {
B = rectPose(els[SLOT_NAMES[i + 1]], CAN_H, CAN_R * 2 * 1.5);
tmp.qB.setFromEuler(tmp.e.set(TILT[i + 1][0], 0, TILT[i + 1][1], "ZXY"));
}
/* ---- spin: idle, scroll, pointer flick, click ---- */
const g = can.current;
const pxw = (stage.px - 0.5) * vw * k;
const pyw = (0.5 - stage.py) * vh * k;
const dx = pxw - g.position.x;
const dy = pyw - g.position.y;
const near = stage.pointerOn * (1 - smooth(0.9, 2.4, Math.hypot(dx, dy) / Math.max(0.4, g.scale.x)));
if (sim.lastScroll < 0) sim.lastScroll = sc;
const dScroll = sc - sim.lastScroll;
sim.lastScroll = sc;
const pvx = ((stage.px - sim.lastPx) * vw) / Math.max(dt, 0.008);
sim.lastPx = stage.px;
if (!still) {
sim.flick = clamp(sim.flick + pvx * 0.016 * dt * near, -7, 7);
if (stage.kick) {
sim.flick += 9 * stage.kick;
sim.pulse = 1;
stage.kick = 0;
}
sim.flick *= Math.exp(-1.5 * dt);
sim.pulse *= Math.exp(-5 * dt);
sim.yaw += ((0.35 + sim.flick) * dt + dScroll * 0.006) * (1 - packK);
if (packK > 0) {
const front = Math.round(sim.yaw / (Math.PI * 2)) * Math.PI * 2;
sim.yaw += (front - sim.yaw) * damp(6, dt) * packK;
}
} else sim.yaw = -0.3;
sim.leanZ += (clamp(-dx * 0.1, -0.22, 0.22) * near * (1 - packK) - sim.leanZ) * damp(6, dt);
sim.leanX += (clamp(-dy * 0.09, -0.2, 0.2) * near * (1 - packK) - sim.leanX) * damp(6, dt);
/* ---- the can ---- */
sim.lift[0] += ((sim.hover === 0 && packK > 0.9 ? 0.2 : 0) - sim.lift[0]) * damp(9, dt);
g.position.set(lerp(A.x, B.x, e), lerp(A.y, B.y, e) + (1 - stage.drop) * VIEW_H * 1.08 + sim.lift[0] * B.s, lerp(A.z, B.z, e) + Math.sin(Math.PI * e) * 0.9);
g.position.x += clamp(dx * 0.035, -0.08, 0.08) * near * (1 - packK);
g.scale.setScalar(lerp(A.s, B.s, e) * (1 + 0.07 * sim.pulse));
tmp.q.slerpQuaternions(tmp.qA, tmp.qB, e);
tmp.q.multiply(tmp.qA.setFromAxisAngle(tmp.Z, Math.sin(Math.PI * e) * 0.45 * TURNS[i]));
tmp.q.multiply(tmp.qA.setFromAxisAngle(tmp.X, TURNS[i] * Math.PI * 2 * e));
tmp.q.multiply(tmp.qA.setFromAxisAngle(tmp.Y, sim.yaw - (1 - stage.spin) * 11 + dx * 0.12 * near * (1 - packK)));
tmp.q.premultiply(tmp.qA.setFromEuler(tmp.e.set(sim.leanX, 0, sim.leanZ, "XYZ")));
g.quaternion.copy(tmp.q);
(built.dew.material as THREE.ShaderMaterial).uniforms.uDew.value = stage.dew;
/* ---- fruit and leaves in orbit ---- */
const gone = stage.burst * (1 - smooth(0.45, 0.85, packT));
for (let n = 0; n < ORBITERS.length; n++) {
const o = ORBITERS[n];
const st = sim.orbit[n];
if (!still) st.a += dt * (o.w + 0.1 * sim.flick);
const rad = o.r * (0.25 + 0.75 * stage.burst);
tmp.v.set(Math.cos(st.a) * rad, o.y * stage.burst + o.inc * Math.sin(st.a) * rad, Math.sin(st.a) * rad).multiplyScalar(g.scale.x).add(g.position);
if (!sim.started || still) st.p.copy(tmp.v);
else st.p.lerp(tmp.v, damp(5 + n * 0.5, dt));
// the pointer pushes them away
tmp.v2.set(st.p.x - pxw, st.p.y - pyw, 0);
const d = tmp.v2.length();
const reach = 1.0;
tmp.v2.multiplyScalar(d < reach && d > 1e-4 ? ((1 - d / reach) ** 2 * 0.75 * stage.pointerOn) / d : 0);
st.push.lerp(tmp.v2, damp(7, dt));
tmp.e.set(o.ph * 3 + t * o.spin[0], o.ph * 5 + t * o.spin[1], o.ph, "XYZ");
tmp.q.setFromEuler(tmp.e);
tmp.s.setScalar(o.size * g.scale.x * gone);
tmp.m.compose(tmp.v.copy(st.p).add(st.push), tmp.q, tmp.s);
if (n < SLICES.length) built.slices.setMatrixAt(n, tmp.m);
else built.leaves.setMatrixAt(n - SLICES.length, tmp.m);
}
built.slices.instanceMatrix.needsUpdate = true;
built.leaves.instanceMatrix.needsUpdate = true;
sim.started = true;
/* ---- backdrop: which two seams are near the viewport, and what the three bands around them are made of ---- */
tmp.v.copy(g.position).project(camera);
bu.uCan.value.set(tmp.v.x * 0.5 + 0.5, tmp.v.y * 0.5 + 0.5);
bu.uRays.value = stage.drop * (1 - packK * 0.6);
bu.uDpr.value = U.uRes.value.y / vh;
bu.uVel.value = stage.vel;
let first = 0;
while (first < 5 && stage.seams[first] - sc < -120) first++;
const seamY = (n: number) => (n < 5 ? stage.seams[n] - sc : 1e4 + n * 1e3);
bu.uSeam.value.set(seamY(first), first, seamY(first + 1), first + 1);
(bu.uBand.value as THREE.Vector3[]).forEach((w, n) => {
const kind = BANDS[Math.min(5, first + n)];
w.set(kind === 0 ? 1 : 0, kind === 1 ? 1 : 0, kind === 2 ? 1 : 0);
});
if (backdrop.current) backdrop.current.material = stage.p > 0.001 && stage.p < 0.999 ? mat.backdropLive : mat.backdrop;
// ... then the pointer trail and the puddle, the bubbles and the giant word fitted to its slot, as described above ...
});
```
### 5.2 Navigation
Fixed, 14px from the top, inside the gutters, `z-index: 50`. One cream pill, 58px high, max-width 1480px, 2px ink outline, hard shadow `0 4px 0 ink`, padding `0 9px 0 24px`. Left: the brand in Dela Gothic One, 1.35rem, uppercase (0.95rem when the name has more than 10 characters; ellipsis beyond 44vw), linking to `#top`. Centre: four label-style links whose 2px ink underline grows from the left on hover and leaves to the right (0.45s, `out`). Right: four 22px round flavour dots in their `pop` colours, 2px ink outline, the current one ringed twice (2px cream, then 2px ink), hover scale 1.22 (`pop`); then a small primary button `Shop` to `#pack`.
Below 1024px the dots are hidden. Below 700px the links too, and an outlined `Menu` / `Close` pill toggles a cream sheet under the bar (24px radius, same outline and shadow) with the four links in Dela Gothic One 1.5rem, numbered in mono. The navigation is cream on every band.
### 5.3 Hero (`#top`, flavour band)
`min-height: max(100svh + 30px, 640px)` (30px taller than the screen, so the first seam waits just under the fold), a flex column, padding `96px gutter 58px`.
- **Top row**: two labels, left the product line, right `No. 01 of 04 / Yuzu Original`, which follows the current flavour.
- **Stage** (`flex: 1`, at least 40svh, relative): the `word` slot fills it; the `hero` slot is 30vw x 64svh, centred and shifted down (`translate(-50%, -44%)`), so the can covers the middle letters of the word and hangs below it. A sticker (5.3.1) sits at `left: calc(50% + 14.5vw); top: 1svh`, width `clamp(92px, 9.6vw, 144px)`.
- **Bottom row** (12 columns, bottom-aligned). Columns 1 to 5: the H1, the lead (max 40ch), a primary button to `#pack` and a ghost button to `#flavours`. Columns 6 to 8, centred: the fill counter (`330` in Dela Gothic One 1.5rem, then the label `ml`) over the scroll hint label at 70 % opacity. Columns 9 to 12, right-aligned: a label and the four flavour chips on two rows (max-width 340px).
**5.3.1 Shared components**
- **Button**: a 54px pill (small: 40px). Its face is an inner `span` (2px ink outline, padding `0 26px`, background `accent`, text `--on-accent`); its hard shadow is a `::before` ink pill 5px lower that never moves. Hover: the face rises 3px (0.35s, `pop`); active: it sinks 4px (0.08s). Ghost: cream face, ink text.
- **Chip**: a 42px pill whose face is an inner `span` (cream, 2px ink outline) with a 20px dot in the flavour's `pop` colour. Hover: the face rises 3px and tilts -2°, the dot grows to 1.3 (`pop`). Selected (`aria-pressed="true"`): ink face, cream text. A chip selects its flavour (6.2).
- **Sticker**: an SVG 40-point star (radii 51 and 58 in a 120 box), cream with a 1.6 ink outline, a ring of mono text on a circle of radius 37 (`textLength="226"`), and a still centre: a Dela numeral over a mono word. Star and ring rotate (6.4).
### 5.4 Manifesto (`#manifesto`, deep band)
Padding `clamp(120px, 19vh, 220px)` / `clamp(90px, 14vh, 170px)`. A label across; the statement on columns 1 to 8, with `skin and all` and `shouts` in the `pop` colour; the `manifesto` slot on columns 9 to 12, 60vh high, centred against the text; under the statement, three figures side by side, each under a 2px rule: a `pop`-coloured numeral with its unit, and a label. The statement lights up word by word with the scroll (6.3).
### 5.5 Flavours (`#flavours`, flavour band, pinned)
The section is `calc(100svh + 280vh)` high and holds one child: `position: sticky; top: 0; height: 100svh; overflow: hidden`. One screen stays pinned for 2.8 screens of scroll. In it:
- **Head**, absolute, 100px from the top: left a label, right the number of the current flavour in Dela Gothic One `clamp(1.8rem, 3.4vw, 3.2rem)` followed by `/ 04` in mono.
- **Track**: a flex row 400 % wide, four panels of 25 %, moved by the scroll (6.2). Each panel centres vertically (padding `70px gutter 40px`) a text column `min(55vw, 860px)` wide, of **definite** width (`flex: none`, grid column `minmax(0, 1fr)`), holding: a label with the number and tasting notes; the **lockup**, the flavour name on two lines, each fitted to the full column width (`YUZU` huge over `ORIGINAL` half its size: a justified poster block); the blurb as a lead (max 38ch); three meters (Sour, Sweet, Fizz), each a label over five 16px circles, filled ink up to the value; a label `Goes with / …`.
- The `flavours` slot, absolute: 26vw x 66svh, centred at 74 % / 53 % of the screen. The can stands there, almost upright, through the whole pinned range while the panels slide and the liquid repaints it.
- **Rail**, bottom right: four outlined mono pills `01 Yuzu Original` to `04 Pink Grapefruit`, the current one ink with cream text; a click scrolls to that flavour (6.2). Bottom left: a hint label at 70 % opacity.
### 5.6 Inside (`#inside`, cream band)
Padding `clamp(120px, 18vh, 210px)` / `clamp(90px, 13vh, 160px)`. Columns 1 to 5: the `inside` slot, 70vh high, with a second sticker at its top right. Columns 7 to 12: a label, the H2, an ordered list of four rows between 2px ink rules, and a closing label with the nutrition line.
A row is a two-column grid (`clamp(5.4rem, 9vw, 8rem)`, then the rest): a numeral in the `accent` colour with its unit, a title (DM Sans 700, 1.2rem) and a description at 80 % opacity (max 48ch). Hover: a `pop` fill grows from the left behind the row (`scaleX`, 0.5s, `out`) and the texts slide 14px right.
### 5.7 Four-pack (`#pack`, flavour band)
`min-height: 100vh`, content vertically centred. Columns 1 to 5: a label, the H2, a lead (max 40ch), a label over the four chips, then the price as a big numeral (multiplied by the quantity) beside a label with the can count; a cream stepper pill (minus, quantity 1 to 9, plus; 54px high; icons grow to 1.2 on hover) next to the primary button, which toggles to an ink button with a check; a tip label at 70 % opacity. Columns 6 to 12: the `pack` slot, 62vh high.
### 5.8 Stockists (`#stockists`, deep band)
Padding-top `clamp(80px, 11vh, 130px)`. First a full-bleed marquee between two 2px rules (22px padding): three press quotes in Dela Gothic One, each followed by its source as a `pop`-coloured label and a `pop` Citrus icon; the line is doubled so it loops (6.4). Then, `clamp(60px, 10vh, 120px)` lower: columns 1 to 4 a label, the H2 and a lead (max 30ch, 85 % opacity); columns 6 to 12 six shop rows between 2px rules. A row is a link: city (label, 7.5rem), name (DM Sans 700, 1.12rem), street (70 % opacity), an ArrowUpRight. Hover: a `pop` fill grows from the bottom (`scaleY`, 0.45s, `out`), the text turns ink, the arrow moves 4px up and right and grows to 1.15.
### 5.9 Footer (deep band)
Padding-top `clamp(40px, 7vh, 90px)`. Row 1: on columns 1 to 5 the newsletter (a label, a line in Dela Gothic One `clamp(1.25rem, 1rem + 1.1vw, 1.9rem)`, max 20ch, a 56px pill field with a 2px cream outline holding an email input and a small button; on submit the field becomes a `pop`-coloured confirmation with a check); from column 7, three link columns, two grid columns each (links slide 6px right and turn `pop` on hover). Row 2: the brand as a giant `pop`-coloured word, uppercase, one line fitted to the content width (font size capped at 50vh), in an `overflow: hidden` box. Row 3: two labels at 80 % opacity.
Fit giant words with a small hook, never a guessed `vw`: set the span to 100px, measure it, set `font-size = 100 · containerWidth / measuredWidth`; rerun on container resize and when fonts have loaded.
## 6. Motion
### 6.1 Intro (finished 2.9s after the page starts)
The page opens blank: cream backdrop, bare aluminium can above the screen, no word, no fruit, the DOM hidden except the counter at `000`. One GSAP timeline, delay 0.15s:
| At (s) | What | Duration | Ease |
| --- | --- | --- | --- |
| 0 | `drop` 0 → 1: the can falls from 1.08 viewport heights above its slot | 1.05 | `back.out(1.3)` |
| 0 | `spin` 0 → 1: 11 rad of extra spin unwind | 1.75 | `power3.out` |
| 0.5 | `p` 0 → 1: the liquid rises, prints the label, uncovers the word; the counter shows `round(330 · p)` on three digits | 1.3 | `power2.inOut` |
| 1.4 | `burst` 0 → 1: fruit and leaves leave the can for their orbits | 1.05 | `back.out(1.5)` |
| 1.45 | `dew` 0 → 1: condensation forms | 0.9 | `power2.out` |
| 1.45 | the navigation drops from `yPercent: -170` | 0.8 | `out` |
| 1.55 | H1 lines rise from `yPercent: 110` in line masks (SplitText, `mask: "lines"`), stagger 0.08 | 0.85 | `out` |
| 1.75 | labels, lead, buttons, hint: `y: 22`, opacity 0 → 1, stagger 0.05 | 0.7 | `out` |
| 1.95 | the chips: scale 0.5 → 1, opacity 0 → 1, stagger 0.05 | 0.5 | `back.out(2)` |
| 1.95 | the sticker: scale 0 → 1, rotation -120° → 0 | 0.75 | `back.out(1.7)` |
When it ends, `from` becomes 0 and the split is reverted. Line masks get `padding-bottom: 0.16em; margin-bottom: -0.16em` so descenders are not cut.
### 6.2 Flavours: clicks and the pinned scrub
The page shows the flavour under the liquid once the line has passed the middle (`p >= 0.5 ? to : from`). Each frame `--pop`, `--accent` and `--deep` are mixed between the two flavours with `t = clamp((p − 0.25) / 0.5)`; `--on-accent` and every `aria-pressed` follow the shown flavour.
- **Outside the pinned range**, choosing a flavour (chip, dot, can) plays a wipe on the clock: `from` = the flavour shown, `to` = the choice, `p` 0 → 1 in 1.15s, `power2.inOut`.
- **Inside the pinned range** the scroll owns the wipe. The 2.8 screens of travel are cut into: lead 0.20; then three times a wipe of 0.66 followed by a rest of 0.16 (no rest after the third); tail 0.30. During wipe `k` (0, 1, 2): `from = k`, `to = k + 1`, `p` = linear progress through that slice, and the track is translated by `−(k + inOut(p)) · 25 %` of its width. Before the range the track is at 0, after it at -75 %. Leaving upward leaves flavour 01 on the page, downward flavour 04.
- Choosing a flavour inside the range scrolls (1.1s, `inOut`) to its rest position: the middle of the lead, of a rest, or of the tail.
- Arriving in the range with a flavour on the page that is neither `k` nor `k + 1`, play a 0.7s wipe to the right one first, then let the scroll take over.
### 6.3 Scroll choreography
1. **The can's journey**: four hops, one tumble each, spin tied to the scroll, fruit trailing (5.1).
2. **Liquid seams**: the five boundaries between bands are waves that swell from 9px to 55px with the scroll speed.
3. **Pinned flavours**: a horizontal track and three scrubbed liquid wipes that re-theme the whole page (6.2).
4. **Manifesto**: SplitText by words; each word goes from opacity 0.16 to 1, stagger 0.1, linear, scrubbed from `top 82%` to `bottom 48%` of the statement. The figures rise 44px and fade in (0.85s, `out`, 0.09s apart, at `top 92%`) and count up from 0 (0.8s, `power2.out`).
5. **Hero exit**: the bottom row moves up 70px and fades out between scroll 0 and 62 % of the hero; the top row 30px, by 40 %.
6. **Four-pack**: the tray rises and three cans fall in on the last hop (5.1).
7. **Footer**: the giant word rises from `yPercent: 62` inside its mask, scrubbed from the moment its box enters the viewport to the end of the page.
Elsewhere: H2s are revealed line by line in masks (`yPercent: 108`, 0.95s, stagger 0.09, `out`, at `top 86%`); labels, leads and blocks rise 26px and fade (0.8s, `out`, at `top 90%`); list rows rise 30px and fade in batches (0.75s, stagger 0.07, at `top 92%`, once); row numerals count up like the figures.
### 6.4 Continuous motion
- Lenis, `lerp: 0.11`, driven by `gsap.ticker` (`lagSmoothing(0)`), feeding `ScrollTrigger.update`. Anchor links scroll with Lenis (1.4s, `inOut`). A `ResizeObserver` on `body` calls `ScrollTrigger.refresh()` whenever the page height changes by 2px or more (a refitted giant word changes it without a window resize), so the footer scrub always ends exactly at the bottom.
- Marquee: `x -= (0.055 + 1.1 · vel) · dt` px (dt in ms), wrapping at half its width.
- Stickers: `rotate(0.014° · ms + 0.11° · scrollPx)`, every other one the other way.
### 6.5 Reduced motion
With `prefers-reduced-motion: reduce`: no Lenis, no intro (the page starts poured: `from = to = 0`, `p = 1`, counter at 330), no reveal, no scrub, nothing pinned. The flavour section becomes a normal block: its label, then the four panels as a 2 x 2 grid of cream cards (2px ink outline, 28px radius, hard shadow), each ending with a ghost button `Pour this one`; slot, counter, rail and hint are hidden. The manifesto and inside slots are hidden and their text takes 10 columns. The canvas renders on demand (scroll, resize, flavour change): the can keeps its hero pose and scrolls away with the hero, fruit and seams are frozen, the four-pack is shown complete with four cans. Choosing a flavour switches at once. CSS transitions are cut to 0.01ms.
## 7. Responsive behaviour
- **Desktop, 1024px and up**: as described.
- **Medium, 700 to 1023px**: hero copy on columns 1 to 6, picker on 8 to 12, counter hidden; flavour text column 54vw; inside text on columns 6 to 12; no navigation dots.
- **Phone, below 700px**:
- Navigation: brand, `Shop`, `Menu`; 52px high, 10px from the top.
- Hero: padding-top 80px; only the right-hand label in the top row; the stage is 47svh high; the `word` slot is the top 13svh of the stage and the `hero` slot (64vw x 39svh) hangs from its bottom, so the word reads above the shoulders of the can; sticker 84px, on the right edge, 15svh down. The bottom row stacks, left-aligned: copy, then picker; the counter is hidden; buttons 50px.
- Manifesto: full width, in the order label, statement, slot (46svh), figures (still three across).
- Flavours: still pinned. Slot 60vw x 36svh centred at 29svh; text column full width at the bottom of the panel (padding-bottom 26px); blurb 0.95rem; rail and hint hidden.
- Inside: slot (48svh), then text. Four-pack: slot (34svh), then copy. Stockists: copy, then shops with city, name and street stacked and the arrow on the right. Footer: newsletter full width, link columns three across.
- The can has to cross text on a phone, so the manifesto statement and the inside text block get an opaque background in the colour of their band (`--deep`, cream), full-bleed with 10px of padding: the can passes behind them.
- The scene has no breakpoint: it reads the slots. No horizontal scroll from 360 to 1440px.
## 8. Accessibility and performance
- Semantics: `header` with `nav`, `main` with six sections, `footer`; one `h1`; one `h2` per section (visually hidden in the flavour section, whose panels are `article`s with an `h3`); a skip link to `#flavours`.
- Canvas and slots are `aria-hidden`. Everything the can does also exists in the DOM: chips, dots and rail are `button`s with `aria-pressed`; meters carry `aria-label="4 out of 5"`; the stepper output is `aria-live="polite"`; the newsletter confirmation has `role="status"`.
- Focus is always visible: 3px ink outline (cream on deep bands), 3px offset. Ink on the four `pop` colours and on cream, and cream on the four `deep` and `accent` colours, pass AA.
- Budgets: device pixel ratio capped at 1.75; **one** WebGL canvas for the page; rendering stopped when the tab is hidden or the canvas is off screen; at most 30 draw calls and 40,000 triangles; instancing for drops, fruit and leaves; no post-processing; no noise or raymarching in the full-screen pass (seams are geometry, the wipe is compiled in only while on screen); labels at most 2048 x 1024; DOM animation on `transform` and `opacity` only (plus the three colour properties); no `backdrop-filter`, no blurred shadow.
- **Reduced motion**: 6.5. The page stays fully readable with nothing pinned.
- **No WebGL** (test `canvas.getContext("webgl2")` before mounting the scene): the canvas is not mounted and `html` gets a class under which the sections paint their own band (`--pop`, `--deep`, cream). The hero shows the brand as a real giant word (the fitting hook, capped at 44vh) and the `hero`, `manifesto`, `flavours` and `inside` slots hold a drawn can: a 360 x 900 2D canvas where the middle 38 % of the same label drawing is clipped to a can silhouette, shaded by a horizontal gradient (dark edges, a bright streak at 27 %), capped with metal gradients, rotated -9°, with a hard 20 % ink drop shadow. The `pack` slot shows four CSS cans in the accent colours. Flavour selection, the pinned track and every colour change still work.
- Fonts use `font-display: swap`; the scene waits for them (section 2).
## 9. Copy deck
Brand-specific words are tokens, written `[TOKEN] :: default`.
- `[BRAND] :: Zest`, `[LEGAL_NAME] :: Zest Drinks Ltd`, `[ORIGIN] :: Kochi`, `[CITY] :: London`, `[PRICE] :: £9`, `[FREE_FROM] :: £18` · page title `Zest — sparkling yuzu, squeezed loud`
- Navigation: `Flavours`, `Inside`, `Four-pack`, `Stockists`, `Shop`, `Menu`, `Close` · skip link `Skip to the flavours`
- Hero labels: `Sparkling yuzu drink / pressed in Kochi / canned cold`, `No. 01 of 04 / Yuzu Original`, `Pick a flavour / or tap the can`, `ml`, `scroll, the can comes with you`
- `[HEADLINE] :: Sparkling yuzu, squeezed loud.`
- `[SUB] :: Real yuzu juice, cold spring water and an unreasonable amount of bubbles. Four flavours, twelve calories, nothing fake.`
- Hero buttons: `Get the four-pack — £9`, `Meet the flavours` · sticker `12` `kcal`, ring `COLD · LOUD · REAL JUICE · NOTHING FAKE ·`
- Manifesto: `01 / Why it tastes like that`, `[STATEMENT] :: We press whole yuzu, skin and all, add cold spring water, then carbonate it until it shouts. No syrup. No sweeteners. No quiet flavours.`
- Figures: `12 kcal` `in a whole can`, `0 g` `added sugar, ever`, `14 %` `real citrus juice`
- Flavours: `02 / The range`, `/ 04`, `Sour` `Sweet` `Fizz`, `Goes with`, `Keep scrolling, the next flavour pours in`, `Pour this one`
- `[FLAVOUR_1] :: Yuzu Original`, `Tart · Floral · Bitter peel` · sour 5, sweet 2, fizz 4 · `Fried chicken, late trains`, `The one that started it. Whole Kochi yuzu, pressed skin and all, so it lands tart, floral and a little bitter. Like the fruit, not like the sweet.` · ingredients `yuzu juice (14%)`
- `[FLAVOUR_2] :: Blood Orange`, `Jammy · Deep · Sour finish` · 3, 3, 4 · `Pizza, loud playlists`, `Sicilian moro orange poured over the yuzu base. Deep, jammy, almost berry, then a sour kick right at the end to keep you honest.`, `yuzu juice (9%), blood orange juice (6%)`
- `[FLAVOUR_3] :: Shiso Lime`, `Herbal · Cooling · Sharp` · 4, 1, 5 · `Sashimi, hot balconies`, `Green shiso leaf and sudachi lime. Herbal, cooling, and sharp enough to wake up a whole table. The bartender's favourite.`, `yuzu juice (8%), sudachi lime juice (5%), shiso leaf`
- `[FLAVOUR_4] :: Pink Grapefruit`, `Bittersweet · Salty · Pink` · 4, 3, 3 · `Tacos, long lunches`, `Ruby grapefruit and one more pinch of sea salt. Bittersweet, properly pink, and gone in about four sips. Order two.`, `yuzu juice (8%), pink grapefruit juice (7%)`
- Inside: `03 / What is in the can`, `Four things. That is the whole list.` · sticker `0` `to hide`, ring `READ THE BACK · WE DARE YOU ·` twice
- Rows: `86 %` `Spring water` `Drawn cold through Nikko granite. Filtered once, not polished to death.`, `14 %` `Citrus juice` `Yuzu first, always. Whole fruit from eleven Kochi growers, pressed within a day of picking.`, `0.1 %` `Sea salt` `A pinch. It makes sour taste brighter, the way it does on a tomato.`, `4.2 vol` `Bubbles` `More carbonation than a cola. That is the loud part.`
- Inside foot: `Per 330 ml can / 12 kcal / 2.9 g sugars, all from fruit / 0 g fat / 0 sweeteners`
- Four-pack: `04 / The four-pack`, `Four loud ones, one cold box.`, `One of each, shipped cold in a cardboard tray you can actually recycle. Choose which flavour leads the box.`, `First in the box`, `£9`, `4 × 330 ml / free delivery over £18`, `Add the four-pack`, `In your box`, `Tip / tap a can to put that flavour first` · stepper `One box fewer`, `One box more`
- Marquee: `“The only soda I would queue for.”` `Cereal Aisle Quarterly`, `“Tart enough to make you sit up.”` `The Sunday Fridge`, `“Dangerously easy to finish.”` `Night Bus Review`
- Stockists: `05 / Stockists`, `Find it cold.`, `Sixty-one fridges and counting. If yours is missing, tell the shop. We deliver within the week.`
- Shops: `London` `Paper Lantern Deli` `Broadway Market`, `London` `Good Company Bottle Shop` `Peckham`, `Manchester` `Northern Quarter Provisions` `Tib Street`, `Bristol` `Harbourside Grocer` `Wapping Wharf`, `Tokyo` `Kissa Hinode` `Shimokitazawa`, `Kochi` `Yuzu Road Farm Stand` `Route 195`
- Footer: `Newsletter`, `The next flavour drops in spring. Hear it first.`, placeholder `Your email`, `Sign up`, `You are on the list. Keep it cold.` · Shop: `Four-pack`, `Mixed case of 12`, `Gift a box`, `Wholesale` · Company: `Our growers`, `Journal`, `Careers`, `Contact` · Follow: `Instagram`, `TikTok`, `Pinterest` · legal: `© 2026 Zest Drinks Ltd / Pressed in Kochi, canned cold in London`, `Privacy / Terms / Recycle the can`
- Label, front: `SPARKLING YUZU · REAL JUICE · NOTHING FAKE ·` (ring) · `330 ML · 12 KCAL A CAN`, `NO. 01 — SPARKLING JUICE DRINK`, `SPARKLING YUZU DRINK`, `330 ML · KEEP COLD · DRINK LOUD`
- Label, sides: `TASTES`, `GOES WITH`, `ALUMINIUM — RECYCLE ME` `FOREVER, PLEASE`, `COLD · LOUD · REAL`, `14%` `REAL JUICE`, `BEST BEFORE: SEE BASE`, `LOT ZT-01-330`
- Label, back: `NUTRITION`, `PER 330 ML CAN`, `ENERGY 12 KCAL`, `SUGARS 2.9 G`, `FAT 0 G`, `SALT 0.03 G`, `SWEETENERS NONE`, `NOTHING ARTIFICIAL. EVER.`, `INGREDIENTS: SPARKLING SPRING WATER, [ingredients of the flavour], SEA SALT. THAT IS THE WHOLE LIST.`, `PRESSED IN KOCHI, CANNED COLD.`
- Lid: `PLEASE RECYCLE · 330 ML · DRINK LOUD ·` · Tray: `[BRAND]`, `FOUR-PACK`, `4 × 330 ML · KEEP COLD`
## 10. Acceptance checklist
- [ ] First screen, 3s after load: yellow page with a pale sunburst; the brand as a giant ink word across the full width; in front of it a cobalt can with a yellow citrus wheel and a climbing cream wordmark; yuzu wheels and leaves in orbit; condensation; headline bottom left, flavour chips bottom right.
- [ ] The intro shows, in order: a bare aluminium can dropping onto a cream page; yellow liquid rising with a wavy edge, drops and foam, printing the label and uncovering the word while the counter runs from 000 to 330; fruit bursting into orbit; masked headline lines. It is over before 3s.
- [ ] Moving the pointer across the can spins and leans it, pushes the fruit away and drags a pale puddle that fades when the pointer stops.
- [ ] Clicking a chip, a dot or the can raises a liquid line across the screen; under it the page, the label, the fruit and the buttons belong to the new flavour. The label changes exactly at the line.
- [ ] Scrolling, the can tumbles end over end once per hop and rests in turn right of the manifesto, right of the pinned flavour screen, left of the ingredient list, and first in the tray.
- [ ] The manifesto lights up word by word; the boundaries between bands are waves that swell when scrolling fast.
- [ ] The flavour section stays pinned for 2.8 screens; panels slide sideways; the scroll repaints the page three times (yellow, orange, lime, pink) and back; the two lines of each name are justified to one width and never touch the can.
- [ ] On the last hop a tray rises and three more cans fall into it, with four different labels; hovering lifts a can; clicking it puts its flavour first.
- [ ] No request leaves the origin. One canvas; pixel ratio never above 1.75; at most 30 draw calls; rendering stops when the tab is hidden.
- [ ] Reduced motion: nothing pinned or scrubbed, four flavour cards, a still can in the hero. No WebGL: bands painted by CSS, giant word and drawn can in the hero, flavours still change.
- [ ] No horizontal scroll from 360 to 1440px; on a phone the can never hides a paragraph.
- [ ] Every control is reachable by keyboard with a visible focus. The build passes with no type error and the console stays clean.