From 8b0b5381a4ae2c149d64371f1313ede0e71bdfb6 Mon Sep 17 00:00:00 2001 From: Tanish Manku Date: Thu, 10 Sep 2026 10:51:11 -0700 Subject: [PATCH] =?UTF-8?q?hero:=20blueprint=20spiral=20poster=20=E2=80=94?= =?UTF-8?q?=20copy,=20CTAs=20&=20the=20emitting=20conveyor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The landing viewport becomes a single-stage poster: the justified ARTCRAFT masthead (still the ruler's hero heading), headline, subline, CTAs, and proof line all sell before the first scroll, over a new blueprint spiral — an Archimedean curve drawn in SVG hairlines with degree ticks, mono annotations, a dashed construction circle, and Seedance render cards pinned along the winding. The spiral is an emitter: cards are born faint at the origin and grow as they wind outward; scroll scrubs the conveyor (reversible) and an idle drift keeps it alive. Cards fade out of the copy block's corner. Everything is SSR-complete (deterministic geometry on a 1600x900 cover stage — container-query math, no JS measurement), so no-JS and reduced-motion visitors get the finished drawing. The WebGL render wall and its tunables are retired; all spiral constants live in three new tuner groups with info hovers. Claude-Session: https://claude.ai/code/session_01YBoaBEt3gynzTwogBFtn4B --- frontend/apps/artcraft-website-next/TUNER.md | 17 +- .../landing/hero-spiral-tunables.ts | 258 ++++++++++ .../src/components/landing/hero-spiral.tsx | 466 +++++++++++++++++ .../src/components/landing/hero-tunables.ts | 159 ------ .../src/components/landing/hero-wall.tsx | 487 ------------------ .../src/components/landing/hero-wordmark.tsx | 314 ++--------- .../src/components/landing/hero.tsx | 98 ++-- 7 files changed, 841 insertions(+), 958 deletions(-) create mode 100644 frontend/apps/artcraft-website-next/src/components/landing/hero-spiral-tunables.ts create mode 100644 frontend/apps/artcraft-website-next/src/components/landing/hero-spiral.tsx delete mode 100644 frontend/apps/artcraft-website-next/src/components/landing/hero-tunables.ts delete mode 100644 frontend/apps/artcraft-website-next/src/components/landing/hero-wall.tsx diff --git a/frontend/apps/artcraft-website-next/TUNER.md b/frontend/apps/artcraft-website-next/TUNER.md index 52bed09056..c80d4a3830 100644 --- a/frontend/apps/artcraft-website-next/TUNER.md +++ b/frontend/apps/artcraft-website-next/TUNER.md @@ -14,9 +14,9 @@ the whole box with `–`, or expand/collapse individual sections. ## Behavior - **Live**: motion/look values are read every frame, so slider changes - apply instantly. Layout values (anything that changes the wall's panel - arrangement itself) trigger a debounced rebuild (~250 ms after the last - change). + apply instantly. Layout values (anything that changes an element's + structure or arrangement itself) trigger a debounced rebuild (~250 ms + after the last change). - **Persistent**: tuned values are stored in `localStorage` (`artcraft-tuner`), so a refresh keeps your tuning. Panel position and section collapse state persist too (`artcraft-tuner-ui`). @@ -59,13 +59,14 @@ Then read values where they're used: inside the loop — it's cheap and picks up changes instantly. - **Build-time consumers** (values baked into geometry/sampling): read at build time and subscribe to `useTunerStore` to trigger a debounced rebuild - when the group's values change (see the Wall layout wiring in - `hero-wall.tsx`). + when the group's values change (see the Spiral layout wiring in + `hero-spiral.tsx`). The panel picks up new groups automatically — no panel changes needed. -Registered groups: Wall layout, Wall motion, Wall look (hero render wall; -`src/components/landing/hero-tunables.ts`) and Ruler layout, Ruler motion, -Ruler look (scroll ruler; `src/components/ruler/ruler-tunables.ts`). +Registered groups: Spiral layout, Spiral motion, Spiral look (hero blueprint +spiral; `src/components/landing/hero-spiral-tunables.ts`) and Ruler layout, +Ruler motion, Ruler look (scroll ruler; +`src/components/ruler/ruler-tunables.ts`). ## Shipping tuned values diff --git a/frontend/apps/artcraft-website-next/src/components/landing/hero-spiral-tunables.ts b/frontend/apps/artcraft-website-next/src/components/landing/hero-spiral-tunables.ts new file mode 100644 index 0000000000..15a17b6754 --- /dev/null +++ b/frontend/apps/artcraft-website-next/src/components/landing/hero-spiral-tunables.ts @@ -0,0 +1,258 @@ +// Every tweakable constant of the hero blueprint spiral, registered with the +// dev tuner (see TUNER.md). Defaults here ARE the shipped values — tune live, +// copy the JSON from the panel, then update the defaults. + +import { defineTunables } from "@/lib/tuner"; + +// Drawing structure — changing these re-renders the SVG linework and the +// cards' base placement. +export const spiralLayoutTuner = defineTunables( + "spiralLayout", + "Spiral layout", + { + cx: { + label: "Center x ×w", + min: 0.3, + max: 1, + step: 0.01, + default: 0.66, + info: "Horizontal position of the spiral's origin, as a fraction of the stage width.", + }, + cy: { + label: "Center y ×h", + min: 0, + max: 1, + step: 0.01, + default: 0.5, + info: "Vertical position of the spiral's origin, as a fraction of the stage height.", + }, + turns: { + label: "Windings", + min: 1.5, + max: 5, + step: 0.25, + default: 3, + info: "How many full revolutions the spiral makes from origin to outer end.", + }, + rMax: { + label: "Outer r px", + min: 300, + max: 1000, + step: 10, + default: 700, + info: "Radius of the spiral's outer end, in stage units (1600×900 stage) — larger bleeds further past the viewport edges.", + }, + phaseDeg: { + label: "Phase °", + min: 0, + max: 360, + step: 5, + default: 210, + info: "Rotates the whole drawing — sets which direction the spiral's outer end exits the stage.", + }, + birthFrac: { + label: "Birth radius", + min: 0.05, + max: 0.6, + step: 0.01, + default: 0.22, + info: "Where cards are born, as a fraction of the outer radius — below this the spiral is linework only.", + }, + tickDeg: { + label: "Tick every °", + min: 5, + max: 45, + step: 1, + default: 10, + info: "Angular spacing of the ticks marked along the spiral's outer windings.", + }, + majorEvery: { + label: "Major every n", + min: 2, + max: 6, + step: 1, + default: 3, + info: "Every n-th tick is a longer major with a degree label.", + }, + tickLen: { + label: "Tick len px", + min: 3, + max: 24, + step: 1, + default: 8, + info: "Length of minor ticks straddling the curve, in stage units; majors are twice this.", + }, + tickMinFrac: { + label: "Ticks from r", + min: 0, + max: 1, + step: 0.05, + default: 0.4, + info: "Ticks only appear outside this fraction of the outer radius — the tight inner windings stay clean.", + }, + constrFrac: { + label: "Constr circle", + min: 0.2, + max: 1, + step: 0.02, + default: 0.62, + info: "Radius of the dashed construction circle, as a fraction of the outer radius.", + }, + radDeg: { + label: "R callout °", + min: 0, + max: 360, + step: 5, + default: 20, + info: "Angle at which the radius dimension line and its R label are drawn.", + }, + cardN: { + label: "Card count", + min: 3, + max: 12, + step: 1, + default: 7, + info: "How many render cards ride the spiral conveyor at once.", + }, + cardW: { + label: "Card w px", + min: 80, + max: 320, + step: 5, + default: 190, + info: "Full-grown card width in stage units; cards are born smaller (see min scale).", + }, + exclX: { + label: "Excl x ×w", + min: 0, + max: 1, + step: 0.01, + default: 0.42, + info: "Cards fade out left of this stage-width fraction when also below the exclusion y — keeps footage from crawling under the copy block.", + }, + exclY: { + label: "Excl y ×h", + min: 0, + max: 1, + step: 0.01, + default: 0.52, + info: "Top edge of the copy-block exclusion zone, as a fraction of the stage height.", + }, + exclFeather: { + label: "Excl feather", + min: 10, + max: 400, + step: 10, + default: 160, + info: "Softness of the exclusion fade, in stage units — cards dim gradually as they enter the zone.", + }, + }, +); + +// Feel knobs — read per frame. +export const spiralMotionTuner = defineTunables( + "spiralMotion", + "Spiral motion", + { + idleSpeed: { + label: "Idle cyc/min", + min: 0, + max: 0.6, + step: 0.01, + default: 0.12, + info: "Unattended conveyor speed — full journeys (birth to edge) per minute; the mechanical drift that keeps the drawing alive.", + }, + scrub: { + label: "Scrub /1kpx", + min: 0, + max: 1, + step: 0.01, + default: 0.18, + info: "Conveyor journeys advanced per 1000px of scroll — scroll-linked and reversible.", + }, + introDur: { + label: "Draw dur s", + min: 0.2, + max: 3, + step: 0.05, + default: 1.4, + info: "Duration of the spiral line's dash-draw from origin to outer end on load.", + }, + introStagger: { + label: "Card stag s", + min: 0, + max: 0.3, + step: 0.01, + default: 0.07, + info: "Delay between successive cards arriving during the intro.", + }, + introDelay: { + label: "Cards after s", + min: 0, + max: 2, + step: 0.05, + default: 0.4, + info: "How long after the line starts drawing the first card arrives.", + }, + }, +); + +// Ink knobs — read per frame / applied at render. +export const spiralLookTuner = defineTunables("spiralLook", "Spiral look", { + lineAlpha: { + label: "Line alpha", + min: 0, + max: 1, + step: 0.05, + default: 0.5, + info: "Opacity of the main spiral hairline.", + }, + tickAlpha: { + label: "Tick alpha", + min: 0, + max: 1, + step: 0.05, + default: 0.6, + info: "Opacity of the ticks along the curve.", + }, + labelAlpha: { + label: "Label alpha", + min: 0, + max: 1, + step: 0.05, + default: 0.5, + info: "Opacity of the mono degree labels and annotation text.", + }, + constrAlpha: { + label: "Constr alpha", + min: 0, + max: 1, + step: 0.05, + default: 0.35, + info: "Opacity of the dashed construction circle and the radius dimension line.", + }, + minScale: { + label: "Birth scale", + min: 0.3, + max: 1, + step: 0.02, + default: 0.55, + info: "Card scale at birth near the origin; cards grow to full size as they wind outward.", + }, + washInner: { + label: "Inner wash", + min: 0, + max: 1, + step: 0.05, + default: 0.35, + info: "Card opacity at birth — newborn cards sit faint near the origin and sharpen as they emerge.", + }, + fadeBand: { + label: "Fade band", + min: 0.02, + max: 0.3, + step: 0.01, + default: 0.1, + info: "Fraction of the journey over which cards fade in at birth and out at the outer edge — also hides the conveyor wrap.", + }, +}); diff --git a/frontend/apps/artcraft-website-next/src/components/landing/hero-spiral.tsx b/frontend/apps/artcraft-website-next/src/components/landing/hero-spiral.tsx new file mode 100644 index 0000000000..e2d41e9821 --- /dev/null +++ b/frontend/apps/artcraft-website-next/src/components/landing/hero-spiral.tsx @@ -0,0 +1,466 @@ +"use client"; + +import { useEffect, useMemo, useRef, useState } from "react"; +import gsap from "gsap"; +import { useTunerStore, type TunableDef, type TunableReader } from "@/lib/tuner"; +import type { SeedanceClip } from "@/lib/landing-data"; +import LazyVideo from "@/components/lazy-video"; +import { + spiralLayoutTuner, + spiralMotionTuner, + spiralLookTuner, +} from "./hero-spiral-tunables"; + +// The hero's creative element: a blueprint spiral — an Archimedean curve +// etched into the paper as a technical drawing (hairline linework, degree +// ticks, mono annotations, a dashed construction circle), with render cards +// pinned along the winding. The spiral is an emitter: cards are born small +// and faint near the origin and grow as they wind outward — the tool at the +// center producing work that spirals out into the world. Scroll advances the +// conveyor (reversible); an idle mechanical drift keeps it alive between. +// +// Everything is SSR-complete: the linework is deterministic SVG and the +// cards' resting poses are inline styles, so no-JS and reduced-motion +// visitors get the finished drawing. Client JS only animates deltas. + +// The drawing lives on a fixed 1600×900 stage that covers the hero like +// background-size: cover (container-query math, no JS measurement), so +// geometry is computed once in stage units and scales with the viewport. +const STAGE_W = 1600; +const STAGE_H = 900; + +const MONO_STYLE: React.CSSProperties = { + fontFamily: "var(--font-mono)", + letterSpacing: "0.12em", + fontSize: 10, +}; + +type Tick = { + x1: number; + y1: number; + x2: number; + y2: number; + major: boolean; +}; + +type TickLabel = { x: number; y: number; text: string }; + +type Geom = { + cx: number; + cy: number; + b: number; + phase: number; + thetaMax: number; + thetaBirth: number; + rMax: number; + pathD: string; + ticks: Tick[]; + tickLabels: TickLabel[]; + constrR: number; + radLine: { x2: number; y2: number; lx: number; ly: number; text: string }; + exclX: number; + exclY: number; + exclFeather: number; + cardW: number; + cardN: number; +}; + +type LayoutValues = { [K in keyof typeof spiralLayoutTuner.defs]: number }; +type LookValues = { [K in keyof typeof spiralLookTuner.defs]: number }; + +type CardPose = { x: number; y: number; scale: number; alpha: number }; + +export default function HeroSpiral({ clips }: { clips: SeedanceClip[] }) { + // -1 = SSR/hydration render: use the registered defaults so server and + // client HTML agree even when localStorage holds tuner overrides. After + // mount the live values apply and every tuner change re-renders (debounced). + const [tunedV, setTunedV] = useState(-1); + const stageRef = useRef(null); + const pathRef = useRef(null); + const inkRef = useRef(null); + const cardEls = useRef<(HTMLDivElement | null)[]>([]); + const conveyorRef = useRef({ idleP: 0, introT: 0, pxScale: 1 }); + + useEffect(() => { + let timer: ReturnType | undefined; + const apply = () => setTunedV(useTunerStore.getState().version); + apply(); + const unsub = useTunerStore.subscribe(() => { + clearTimeout(timer); + timer = setTimeout(apply, 150); + }); + return () => { + clearTimeout(timer); + unsub(); + }; + }, []); + + const layout = useMemo( + () => (tunedV < 0 ? defaultsOf(spiralLayoutTuner) : spiralLayoutTuner.read()), + [tunedV], + ); + const look = useMemo( + () => (tunedV < 0 ? defaultsOf(spiralLookTuner) : spiralLookTuner.read()), + [tunedV], + ); + const geom = useMemo(() => buildGeometry(layout), [layout]); + + // Resting poses (conveyor at 0). Cards sit at half-slot offsets so none is + // born exactly at the wrap seam (alpha 0) in the static drawing. + const bases = useMemo( + () => + Array.from({ length: geom.cardN }, (_, i) => + cardPose(geom, look, (i + 0.5) / geom.cardN), + ), + [geom, look], + ); + const geomRef = useRef(geom); + const basesRef = useRef(bases); + geomRef.current = geom; + basesRef.current = bases; + + // Stage scale: stage units → CSS px, for the per-frame delta transforms. + useEffect(() => { + const stage = stageRef.current; + if (!stage) return; + const measure = () => { + conveyorRef.current.pxScale = stage.clientWidth / STAGE_W || 1; + }; + measure(); + const ro = new ResizeObserver(measure); + ro.observe(stage); + return () => ro.disconnect(); + }, []); + + // The conveyor loop: scroll-scrubbed + idle drift, intro gate on top. + useEffect(() => { + if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return; + const state = conveyorRef.current; + const tick = (_time: number, deltaMs: number) => { + const dt = Math.min(0.1, deltaMs / 1000); + const mv = spiralMotionTuner.read(); + const lk = spiralLookTuner.read(); + const g = geomRef.current; + state.idleP += (dt * mv.idleSpeed) / 60; + state.introT += dt; + const p = state.idleP + (window.scrollY * mv.scrub) / 1000; + for (let i = 0; i < cardEls.current.length; i++) { + const el = cardEls.current[i]; + const base = basesRef.current[i]; + if (!el || !base) continue; + const pose = cardPose(g, lk, cycle((i + 0.5) / g.cardN + p)); + const dx = (pose.x - base.x) * state.pxScale; + const dy = (pose.y - base.y) * state.pxScale; + const introK = clamp01( + (state.introT - mv.introDelay - i * mv.introStagger) / 0.5, + ); + el.style.transform = `translate(-50%, -50%) translate(${dx.toFixed(1)}px, ${dy.toFixed(1)}px) scale(${pose.scale.toFixed(3)})`; + el.style.opacity = (pose.alpha * introK).toFixed(3); + } + }; + gsap.ticker.add(tick); + return () => gsap.ticker.remove(tick); + }, []); + + // Intro: the line dash-draws origin→edge, then the ink (ticks, labels, + // construction) fades up along it. Cards gate themselves in the loop. + useEffect(() => { + if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return; + const path = pathRef.current; + const ink = inkRef.current; + if (!path || !ink) return; + const mv = spiralMotionTuner.read(); + const tl = gsap.timeline(); + tl.fromTo( + path, + { strokeDasharray: 1, strokeDashoffset: 1 }, + { + strokeDashoffset: 0, + duration: mv.introDur, + ease: "power2.out", + clearProps: "strokeDasharray,strokeDashoffset", + }, + ); + tl.from( + ink.children, + { opacity: 0, duration: 0.5, stagger: 0.012, ease: "none" }, + mv.introDur * 0.35, + ); + return () => { + tl.kill(); + }; + }, []); + + return ( +
+
+ + + + {geom.ticks.map((t, i) => ( + + ))} + {geom.tickLabels.map((l, i) => ( + + {l.text} + + ))} + + + + {geom.radLine.text} + + + + + ORIGIN 0,0 + + + + + {bases.map((base, i) => { + const clip = clips[i % clips.length]; + const clipNo = String((i % clips.length) + 1).padStart(3, "0"); + return ( +
{ + cardEls.current[i] = el; + }} + className="absolute" + style={{ + left: `${((base.x / STAGE_W) * 100).toFixed(2)}%`, + top: `${((base.y / STAGE_H) * 100).toFixed(2)}%`, + width: `${((geom.cardW / STAGE_W) * 100).toFixed(2)}%`, + transform: `translate(-50%, -50%) scale(${base.scale.toFixed(3)})`, + opacity: base.alpha.toFixed(3), + willChange: "transform, opacity", + }} + > +
+ +
+

+ Seedance 2.5 · {clipNo} +

+
+ ); + })} +
+
+ ); +} + +// ————— Geometry ————— + +// Archimedean spiral r = b·θ, drawn in stage units. All derived marks (ticks, +// labels, construction) come from the same parameters so the drawing always +// agrees with the cards' travel path. +function buildGeometry(v: LayoutValues): Geom { + const cx = v.cx * STAGE_W; + const cy = v.cy * STAGE_H; + const thetaMax = v.turns * Math.PI * 2; + const b = v.rMax / thetaMax; + const phase = (v.phaseDeg * Math.PI) / 180; + + const pts: string[] = []; + const steps = 480; + for (let i = 0; i <= steps; i++) { + const theta = (i / steps) * thetaMax; + const r = b * theta; + const a = theta + phase; + pts.push( + `${(cx + r * Math.cos(a)).toFixed(1)} ${(cy + r * Math.sin(a)).toFixed(1)}`, + ); + } + const pathD = `M ${pts.join(" L ")}`; + + const ticks: Tick[] = []; + const tickLabels: TickLabel[] = []; + const tickRad = (v.tickDeg * Math.PI) / 180; + const rMin = v.tickMinFrac * v.rMax; + for (let k = 0; k * tickRad <= thetaMax; k++) { + const theta = k * tickRad; + const r = b * theta; + if (r < rMin) continue; + const a = theta + phase; + const ux = Math.cos(a); + const uy = Math.sin(a); + const major = k % v.majorEvery === 0; + const len = major ? v.tickLen * 2 : v.tickLen; + ticks.push({ + x1: cx + (r - len / 2) * ux, + y1: cy + (r - len / 2) * uy, + x2: cx + (r + len / 2) * ux, + y2: cy + (r + len / 2) * uy, + major, + }); + if (major) { + // Accumulated θ, spiral-honest: it keeps counting past 360. + tickLabels.push({ + x: cx + (r + len / 2 + 16) * ux, + y: cy + (r + len / 2 + 16) * uy, + text: `${Math.round(k * v.tickDeg)}°`, + }); + } + } + + const constrR = v.constrFrac * v.rMax; + const ra = (v.radDeg * Math.PI) / 180; + const radLine = { + x2: cx + constrR * Math.cos(ra), + y2: cy + constrR * Math.sin(ra), + lx: cx + (constrR / 2) * Math.cos(ra) - 14 * Math.sin(ra), + ly: cy + (constrR / 2) * Math.sin(ra) + 14 * Math.cos(ra), + text: `R ${Math.round(constrR)}`, + }; + + return { + cx, + cy, + b, + phase, + thetaMax, + thetaBirth: v.birthFrac * thetaMax, + rMax: v.rMax, + pathD, + ticks, + tickLabels, + constrR, + radLine, + exclX: v.exclX * STAGE_W, + exclY: v.exclY * STAGE_H, + exclFeather: v.exclFeather, + cardW: v.cardW, + cardN: v.cardN, + }; +} + +// A card's pose at cycle position c ∈ [0,1): born faint and small near the +// origin, full-grown at the outer end. The exclusion term fades cards out of +// the copy block's bottom-left zone; the fade bands hide the conveyor wrap. +function cardPose(g: Geom, lk: LookValues, c: number): CardPose { + const theta = g.thetaBirth + c * (g.thetaMax - g.thetaBirth); + const r = g.b * theta; + const a = theta + g.phase; + const x = g.cx + r * Math.cos(a); + const y = g.cy + r * Math.sin(a); + const scale = lk.minScale + (1 - lk.minScale) * c; + const fade = + clamp01(c / lk.fadeBand) * clamp01((1 - c) / lk.fadeBand); + const wash = lk.washInner + (1 - lk.washInner) * c; + const inZone = + smooth01((g.exclX - x) / g.exclFeather) * + smooth01((y - g.exclY) / g.exclFeather); + return { x, y, scale, alpha: fade * wash * (1 - inZone) }; +} + +// ————— Leaf helpers ————— + +const clamp01 = (x: number) => Math.max(0, Math.min(1, x)); + +const cycle = (x: number) => ((x % 1) + 1) % 1; + +function smooth01(t: number) { + const u = clamp01(t); + return u * u * (3 - 2 * u); +} + +function defaultsOf>( + tuner: TunableReader, +): { [K in keyof T]: number } { + const out = {} as { [K in keyof T]: number }; + for (const key in tuner.defs) out[key] = tuner.defs[key].default; + return out; +} diff --git a/frontend/apps/artcraft-website-next/src/components/landing/hero-tunables.ts b/frontend/apps/artcraft-website-next/src/components/landing/hero-tunables.ts deleted file mode 100644 index aa04b72b3e..0000000000 --- a/frontend/apps/artcraft-website-next/src/components/landing/hero-tunables.ts +++ /dev/null @@ -1,159 +0,0 @@ -// Every tweakable constant of the hero render wall, registered with the dev -// tuner (see TUNER.md). Defaults here ARE the shipped values — tune live, -// copy the JSON from the panel, then update the defaults. - -import { defineTunables } from "@/lib/tuner"; - -// Wall structure — moving these rebuilds the panel layout (debounced). -export const wallLayoutTuner = defineTunables("wallLayout", "Wall layout", { - rowHeight: { - label: "Near row × vh", - min: 0.14, - max: 0.55, - step: 0.01, - default: 0.33, - info: "Panel height of the near row, as a fraction of the viewport height.", - }, - rowScale: { - label: "Row shrink", - min: 0.5, - max: 1, - step: 0.01, - default: 0.73, - info: "How much each deeper row's panels shrink relative to the row in front.", - }, - gap: { - label: "Gap px", - min: 8, - max: 80, - step: 1, - default: 25, - info: "Horizontal gap between panels within a row.", - }, - zStep: { - label: "Row z step px", - min: 0, - max: 400, - step: 5, - default: 170, - info: "Depth distance between successive rows of the wall.", - }, - yNear: { - label: "Near row y × vh", - min: -0.5, - max: 0.5, - step: 0.01, - default: -0.17, - info: "Vertical position of the near row, in viewport heights from center.", - }, - yMid: { - label: "Mid row y × vh", - min: -0.5, - max: 0.5, - step: 0.01, - default: 0.17, - info: "Vertical position of the mid row, in viewport heights from center.", - }, -}); - -export const wallMotionTuner = defineTunables("wallMotion", "Wall motion", { - yawDeg: { - label: "Yaw °", - min: -35, - max: 35, - step: 0.5, - default: -11, - info: "Resting sideways rotation of the whole wall.", - }, - pitchDeg: { - label: "Pitch °", - min: -12, - max: 12, - step: 0.25, - default: 2.5, - info: "Resting up/down rotation of the whole wall.", - }, - speed: { - label: "Drift px/s", - min: 0, - max: 240, - step: 2, - default: 42, - info: "Unattended sideways drift speed of the near row.", - }, - speedStep: { - label: "Row parallax", - min: 0.3, - max: 1, - step: 0.02, - default: 0.62, - info: "Depth parallax: each deeper row moves this fraction of the row in front.", - }, - dragMax: { - label: "Max throw px/s", - min: 400, - max: 6000, - step: 100, - default: 2400, - info: "Speed cap on the momentum a drag can throw the wall with.", - }, - introBurst: { - label: "Intro burst ×", - min: 1, - max: 40, - step: 1, - default: 16, - info: "Multiple of the drift speed the wall sweeps in with on load before easing down.", - }, - parallax: { - label: "Pointer tilt rad", - min: 0, - max: 0.09, - step: 0.002, - default: 0.024, - info: "How far the pointer position tilts the whole wall.", - }, -}); - -export const wallLookTuner = defineTunables("wallLook", "Wall look", { - dimNear: { - label: "Near row dim", - min: 0, - max: 1, - step: 0.02, - default: 0.86, - info: "Brightness of the near row's footage (1 = full strength).", - }, - dimMid: { - label: "Mid row dim", - min: 0, - max: 1, - step: 0.02, - default: 0.7, - info: "Brightness of the mid row's footage — deeper rows recede into the background.", - }, - washLight: { - label: "Light wash", - min: 0, - max: 1, - step: 0.02, - default: 0.15, - info: "Light theme only: how much deeper rows wash toward the paper via opacity.", - }, - edgeFade: { - label: "Edge fade", - min: 0, - max: 1, - step: 0.02, - default: 0.65, - info: "How strongly panels vignette out toward the viewport's left/right edges.", - }, - frameAlpha: { - label: "Frame alpha", - min: 0, - max: 1, - step: 0.02, - default: 0.18, - info: "Opacity of the hairline frames around each panel.", - }, -}); diff --git a/frontend/apps/artcraft-website-next/src/components/landing/hero-wall.tsx b/frontend/apps/artcraft-website-next/src/components/landing/hero-wall.tsx deleted file mode 100644 index caf6462768..0000000000 --- a/frontend/apps/artcraft-website-next/src/components/landing/hero-wall.tsx +++ /dev/null @@ -1,487 +0,0 @@ -"use client"; - -import { useEffect, useMemo, useRef, useState } from "react"; -import { useFrame, useThree } from "@react-three/fiber"; -import * as THREE from "three"; -import { SEEDANCE_SHOWCASE } from "@/lib/landing-data"; -import type { ThemeColors } from "@/lib/theme-colors"; -import { useTunerStore } from "@/lib/tuner"; -import { - wallLayoutTuner, - wallLookTuner, - wallMotionTuner, -} from "./hero-tunables"; - -// The render wall: two film-strip rows of showcase clips forming one -// yawed, pitched wall behind the wordmark. Rows sit at stepped depths and -// drift sideways at speeds proportional to their depth — real parallax, -// like passing a wall of screens — and each row loops seamlessly (panels -// wrap around offscreen). Near row is full strength; deeper rows dim into -// the background so the type always owns the composition, and panels -// vignette out toward the screen edges. -// -// A drag anywhere throws the wall with momentum (the hero container feeds -// drag state in via the WallDrag ref, since the canvas itself is -// pointer-events: none); the pointer also tilts the whole wall a few -// degrees. Unattended it drifts at a slow walking pace. -// -// The scene is fitted 1 world unit == 1 CSS px at z=0, so layout below is -// in pixels. Each clip decodes once; panels showing the same clip share -// one VideoTexture. - -// Drag state written by the hero container's pointer handlers and consumed -// here every frame. -export type WallDrag = { - dragging: boolean; - dx: number; // accumulated drag pixels since the wall last consumed them - vel: number; // smoothed drag velocity, px/s -}; - -export function createWallDrag(): WallDrag { - return { dragging: false, dx: 0, vel: 0 }; -} - -const ROW_COUNT = 2; -const FOV = 30; // must match FittedCamera in hero-wordmark.tsx - -// Decode budget. A wall of 1080p clips all decoding at once is what makes -// the hero feel heavy, so only the clips whose panels are near the viewport -// keep a decoder; the rest pause on their last frame (already invisible -// behind the edge vignette). Playback decisions run on their own slow tick, -// since play/pause churn at 60 Hz would cost more than it saves, and a clip -// holds its slot briefly after leaving so one hovering at the edge does not -// stutter. Panels beyond CULL_EDGE half-widths are fully off screen: a panel -// is clear of the edge once its center passes ~1.25. -const CULL_EDGE = 1.4; -const CULL_TICK_S = 0.25; -const CULL_HOLD_S = 1.2; -const MAX_DECODING = 12; -// Starting a decoder is the expensive moment (demux, buffer, first keyframe), -// so only a couple are started per tick. Scrolling back to the hero would -// otherwise restart a dozen at once and hitch the frame it lands on; instead -// the wall refills over about a second, behind the panels' own fade-in. -const RESUME_PER_TICK = 3; -// Grace period before a scrolled-away wall gives up its decoders. The frame -// loop is already stopped by then, so a few seconds of idle decoding is -// cheaper than the restart a quick scroll down and back would otherwise pay. -const PARK_DELAY_MS = 2500; -const FAR_EDGE = 1e6; // stand-in distance for a clip with no panel this frame - -type WallPanel = { - clip: number; - w: number; - h: number; - x0: number; // resting position of the panel center along its row - y: number; - z: number; - row: number; - length: number; // total loop length of the row this panel rides -}; - -function smoothstep(edge0: number, edge1: number, x: number): number { - const t = Math.max(0, Math.min(1, (x - edge0) / (edge1 - edge0))); - return t * t * (3 - 2 * t); -} - -export default function HeroWall({ - pointer, - drag, - colors, - onScreen, -}: { - pointer: React.RefObject<{ x: number; y: number; active: boolean }>; - drag: React.RefObject; - colors: ThemeColors; - // False once the hero has scrolled away or the tab went to the background. - // The frame loop is stopped then, so playback is parked from an effect. - onScreen: boolean; -}) { - const size = useThree((s) => s.size); - const rigRef = useRef(null); - const groupRefs = useRef<(THREE.Group | null)[]>([]); - const state = useRef({ - offset: 0, - speed: 0, - wasDragging: false, - started: false, - cullTimer: 0, - }); - const tilt = useRef({ x: 0, y: 0 }); - - const dark = useMemo(() => { - const c = new THREE.Color(colors.bg); - return c.r + c.g + c.b < 1.5; - }, [colors.bg]); - - // One