mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-15 22:32:13 +00:00
hero: blueprint spiral poster — copy, CTAs & the emitting conveyor
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
This commit is contained in:
1 parent
5fa95ccb06
commit
8b0b5381a4
7 files changed
+841
-958
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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.",
|
||||
},
|
||||
});
|
||||
@@ -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<HTMLDivElement>(null);
|
||||
const pathRef = useRef<SVGPathElement>(null);
|
||||
const inkRef = useRef<SVGGElement>(null);
|
||||
const cardEls = useRef<(HTMLDivElement | null)[]>([]);
|
||||
const conveyorRef = useRef({ idleP: 0, introT: 0, pxScale: 1 });
|
||||
|
||||
useEffect(() => {
|
||||
let timer: ReturnType<typeof setTimeout> | 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 (
|
||||
<div aria-hidden className="absolute inset-0 overflow-hidden [container-type:size]">
|
||||
<div
|
||||
ref={stageRef}
|
||||
className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
|
||||
style={{
|
||||
width: `max(100cqw, ${(100 * STAGE_W) / STAGE_H}cqh)`,
|
||||
height: `max(100cqh, ${(100 * STAGE_H) / STAGE_W}cqw)`,
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
viewBox={`0 0 ${STAGE_W} ${STAGE_H}`}
|
||||
className="absolute inset-0 h-full w-full"
|
||||
>
|
||||
<path
|
||||
ref={pathRef}
|
||||
d={geom.pathD}
|
||||
pathLength={1}
|
||||
fill="none"
|
||||
stroke="var(--line-strong)"
|
||||
strokeWidth={1}
|
||||
vectorEffect="non-scaling-stroke"
|
||||
opacity={look.lineAlpha}
|
||||
/>
|
||||
<g ref={inkRef}>
|
||||
{geom.ticks.map((t, i) => (
|
||||
<line
|
||||
key={`t${i}`}
|
||||
x1={t.x1}
|
||||
y1={t.y1}
|
||||
x2={t.x2}
|
||||
y2={t.y2}
|
||||
stroke="var(--line-strong)"
|
||||
strokeWidth={1}
|
||||
vectorEffect="non-scaling-stroke"
|
||||
opacity={t.major ? look.tickAlpha : look.tickAlpha * 0.6}
|
||||
/>
|
||||
))}
|
||||
{geom.tickLabels.map((l, i) => (
|
||||
<text
|
||||
key={`l${i}`}
|
||||
x={l.x}
|
||||
y={l.y}
|
||||
textAnchor="middle"
|
||||
dominantBaseline="middle"
|
||||
style={{ ...MONO_STYLE, fill: "var(--muted)" }}
|
||||
opacity={look.labelAlpha}
|
||||
>
|
||||
{l.text}
|
||||
</text>
|
||||
))}
|
||||
<circle
|
||||
cx={geom.cx}
|
||||
cy={geom.cy}
|
||||
r={geom.constrR}
|
||||
fill="none"
|
||||
stroke="var(--line-strong)"
|
||||
strokeWidth={1}
|
||||
strokeDasharray="5 6"
|
||||
vectorEffect="non-scaling-stroke"
|
||||
opacity={look.constrAlpha}
|
||||
/>
|
||||
<line
|
||||
x1={geom.cx}
|
||||
y1={geom.cy}
|
||||
x2={geom.radLine.x2}
|
||||
y2={geom.radLine.y2}
|
||||
stroke="var(--line-strong)"
|
||||
strokeWidth={1}
|
||||
vectorEffect="non-scaling-stroke"
|
||||
opacity={look.constrAlpha}
|
||||
/>
|
||||
<text
|
||||
x={geom.radLine.lx}
|
||||
y={geom.radLine.ly}
|
||||
textAnchor="middle"
|
||||
dominantBaseline="middle"
|
||||
style={{ ...MONO_STYLE, fill: "var(--muted)" }}
|
||||
opacity={look.labelAlpha}
|
||||
>
|
||||
{geom.radLine.text}
|
||||
</text>
|
||||
<line
|
||||
x1={geom.cx - 10}
|
||||
y1={geom.cy}
|
||||
x2={geom.cx + 10}
|
||||
y2={geom.cy}
|
||||
stroke="var(--ink)"
|
||||
strokeWidth={1}
|
||||
vectorEffect="non-scaling-stroke"
|
||||
opacity={look.tickAlpha}
|
||||
/>
|
||||
<line
|
||||
x1={geom.cx}
|
||||
y1={geom.cy - 10}
|
||||
x2={geom.cx}
|
||||
y2={geom.cy + 10}
|
||||
stroke="var(--ink)"
|
||||
strokeWidth={1}
|
||||
vectorEffect="non-scaling-stroke"
|
||||
opacity={look.tickAlpha}
|
||||
/>
|
||||
<text
|
||||
x={geom.cx + 16}
|
||||
y={geom.cy - 12}
|
||||
style={{ ...MONO_STYLE, fill: "var(--muted)" }}
|
||||
opacity={look.labelAlpha}
|
||||
>
|
||||
ORIGIN 0,0
|
||||
</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
{bases.map((base, i) => {
|
||||
const clip = clips[i % clips.length];
|
||||
const clipNo = String((i % clips.length) + 1).padStart(3, "0");
|
||||
return (
|
||||
<div
|
||||
key={i}
|
||||
ref={(el) => {
|
||||
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",
|
||||
}}
|
||||
>
|
||||
<div className="border border-line-strong bg-bg-sunken">
|
||||
<LazyVideo
|
||||
src={clip.src}
|
||||
className="block aspect-video w-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
<p
|
||||
className="mt-1 font-mono text-[9px] tracking-[0.15em] text-faint uppercase"
|
||||
>
|
||||
Seedance 2.5 · {clipNo}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// ————— 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<T extends Record<string, TunableDef>>(
|
||||
tuner: TunableReader<T>,
|
||||
): { [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;
|
||||
}
|
||||
@@ -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.",
|
||||
},
|
||||
});
|
||||
@@ -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<WallDrag>;
|
||||
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<THREE.Group>(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 <video> and one shared texture per clip.
|
||||
const videos = useMemo(
|
||||
() =>
|
||||
SEEDANCE_SHOWCASE.map((clip) => {
|
||||
const v = document.createElement("video");
|
||||
v.src = clip.src;
|
||||
v.muted = true;
|
||||
v.loop = true;
|
||||
v.playsInline = true;
|
||||
v.crossOrigin = "anonymous";
|
||||
v.disableRemotePlayback = true;
|
||||
// Metadata only: fetching every clip up front stalls the whole page
|
||||
// on load. The decode budget below calls play() as panels approach,
|
||||
// which pulls each clip down roughly in the order it is needed.
|
||||
v.preload = "metadata";
|
||||
return v;
|
||||
}),
|
||||
[],
|
||||
);
|
||||
const textures = useMemo(
|
||||
() =>
|
||||
videos.map((v, i) => {
|
||||
const t = new THREE.VideoTexture(v);
|
||||
t.colorSpace = THREE.SRGBColorSpace;
|
||||
// Cover-fit the source into the panel plane (GL has no object-cover):
|
||||
// crop the longer axis via repeat/offset once dimensions are known.
|
||||
const fit = () => {
|
||||
const va = v.videoWidth / v.videoHeight || 16 / 9;
|
||||
const pa = SEEDANCE_SHOWCASE[i].aspect;
|
||||
if (va > pa) {
|
||||
t.repeat.set(pa / va, 1);
|
||||
t.offset.set((1 - pa / va) / 2, 0);
|
||||
} else {
|
||||
t.repeat.set(1, va / pa);
|
||||
t.offset.set(0, (1 - va / pa) / 2);
|
||||
}
|
||||
};
|
||||
if (v.readyState >= 1) fit();
|
||||
else v.addEventListener("loadedmetadata", fit, { once: true });
|
||||
return t;
|
||||
}),
|
||||
[videos],
|
||||
);
|
||||
// Video lifecycle is keyed to the videos/textures alone. Re-arm sources
|
||||
// on every run: React strict mode (and any remount) runs the cleanup,
|
||||
// which unloads the shared <video> elements the memo still holds.
|
||||
useEffect(() => {
|
||||
videos.forEach((v, i) => {
|
||||
if (!v.getAttribute("src")) {
|
||||
v.src = SEEDANCE_SHOWCASE[i].src;
|
||||
v.load();
|
||||
}
|
||||
});
|
||||
return () => {
|
||||
textures.forEach((t) => t.dispose());
|
||||
videos.forEach((v) => {
|
||||
v.pause();
|
||||
v.removeAttribute("src");
|
||||
v.load();
|
||||
});
|
||||
};
|
||||
}, [videos, textures]);
|
||||
|
||||
// Scrolled away or backgrounded: the frame loop is stopped, so nothing
|
||||
// would ever pause these. Park them all after a grace period; the budget
|
||||
// re-grants slots on the first frame after the hero comes back.
|
||||
useEffect(() => {
|
||||
if (onScreen) return;
|
||||
const timer = setTimeout(
|
||||
() => videos.forEach((v) => v.pause()),
|
||||
PARK_DELAY_MS,
|
||||
);
|
||||
return () => clearTimeout(timer);
|
||||
}, [onScreen, videos]);
|
||||
|
||||
// Layout tunables change the wall's structure — debounce a rebuild.
|
||||
const [layoutVersion, setLayoutVersion] = useState(0);
|
||||
useEffect(() => {
|
||||
let last = JSON.stringify(wallLayoutTuner.read());
|
||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||
const unsubscribe = useTunerStore.subscribe(() => {
|
||||
const now = JSON.stringify(wallLayoutTuner.read());
|
||||
if (now === last) return;
|
||||
last = now;
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => setLayoutVersion((v) => v + 1), 250);
|
||||
});
|
||||
return () => {
|
||||
clearTimeout(timer);
|
||||
unsubscribe();
|
||||
};
|
||||
}, []);
|
||||
|
||||
// Wall structure: per row, panels are laid end to end with a uniform gap
|
||||
// until they cover the yawed viewport plus one panel of margin, so the
|
||||
// wrap-around teleport always happens offscreen. Rows shrink and recede
|
||||
// with depth; each row draws from its own disjoint slice of the clip
|
||||
// pool, so no clip ever appears in more than one row.
|
||||
const layout = useMemo(() => {
|
||||
const t = wallLayoutTuner.read();
|
||||
const nearH = Math.min(460, Math.max(110, size.height * t.rowHeight));
|
||||
const yFracs = [t.yNear, t.yMid];
|
||||
const clipCount = SEEDANCE_SHOWCASE.length;
|
||||
const perRow = Math.floor(clipCount / ROW_COUNT);
|
||||
const extra = clipCount % ROW_COUNT;
|
||||
const panels: WallPanel[] = [];
|
||||
for (let i = 0; i < ROW_COUNT; i++) {
|
||||
// Remainder clips go to the deeper rows: their panels are smaller, so
|
||||
// they need more of them and repeat soonest without the bigger slice.
|
||||
const extraBefore = Math.max(0, i - (ROW_COUNT - extra));
|
||||
const rowStart = i * perRow + extraBefore;
|
||||
const rowClips = Math.max(1, perRow + (i >= ROW_COUNT - extra ? 1 : 0));
|
||||
const h = nearH * Math.pow(t.rowScale, i);
|
||||
const span = size.width * 1.5 + h * 2.6;
|
||||
let x = 0;
|
||||
let k = 0;
|
||||
const rowPanels: WallPanel[] = [];
|
||||
while (x < span) {
|
||||
const clip = (rowStart + (k % rowClips)) % clipCount;
|
||||
const w = h * SEEDANCE_SHOWCASE[clip].aspect;
|
||||
rowPanels.push({
|
||||
clip,
|
||||
w,
|
||||
h,
|
||||
x0: x + w / 2,
|
||||
y: size.height * yFracs[i],
|
||||
z: -t.zStep * i,
|
||||
row: i,
|
||||
length: 0,
|
||||
});
|
||||
x += w + t.gap;
|
||||
k++;
|
||||
}
|
||||
// The row is a loop, so the seam (last panel wrapping around to meet
|
||||
// the first) is an adjacency too. When the cycle length doesn't divide
|
||||
// the panel count, the seam can pair a clip with itself — bump the
|
||||
// last panel one step along the slice, which is distinct from both
|
||||
// neighbors whenever the slice holds 3+ clips.
|
||||
const last = rowPanels[rowPanels.length - 1];
|
||||
if (rowPanels.length > 1 && rowClips >= 3 && last.clip === rowPanels[0].clip) {
|
||||
const left = last.x0 - last.w / 2;
|
||||
last.clip = rowStart + ((last.clip - rowStart + 1) % rowClips);
|
||||
last.w = last.h * SEEDANCE_SHOWCASE[last.clip].aspect;
|
||||
last.x0 = left + last.w / 2;
|
||||
x = left + last.w + t.gap;
|
||||
}
|
||||
for (const p of rowPanels) p.length = x;
|
||||
panels.push(...rowPanels);
|
||||
}
|
||||
const frames = panels.map(
|
||||
(p) => new THREE.EdgesGeometry(new THREE.PlaneGeometry(p.w, p.h)),
|
||||
);
|
||||
return { panels, frames };
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [size.width, size.height, layoutVersion]);
|
||||
useEffect(() => () => layout.frames.forEach((f) => f.dispose()), [layout]);
|
||||
|
||||
// Per-panel materials (panels share clip textures but dim and vignette
|
||||
// independently, so each needs its own color/opacity).
|
||||
const materials = useMemo(
|
||||
() =>
|
||||
layout.panels.map(
|
||||
(p) =>
|
||||
new THREE.MeshBasicMaterial({
|
||||
map: textures[p.clip],
|
||||
transparent: true,
|
||||
toneMapped: false,
|
||||
}),
|
||||
),
|
||||
[textures, layout],
|
||||
);
|
||||
const frameMaterials = useMemo(
|
||||
() =>
|
||||
layout.panels.map(
|
||||
() => new THREE.LineBasicMaterial({ transparent: true }),
|
||||
),
|
||||
[layout],
|
||||
);
|
||||
// Frame color follows the theme imperatively — recreating the materials
|
||||
// on a color change would churn the panel meshes for nothing.
|
||||
useEffect(() => {
|
||||
frameMaterials.forEach((m) => m.color.set(colors.lineStrong));
|
||||
}, [frameMaterials, colors.lineStrong]);
|
||||
useEffect(() => () => materials.forEach((m) => m.dispose()), [materials]);
|
||||
useEffect(
|
||||
() => () => frameMaterials.forEach((m) => m.dispose()),
|
||||
[frameMaterials],
|
||||
);
|
||||
|
||||
// Per-panel video readiness, eased: until a clip has decodable frames its
|
||||
// panels stay as empty hairline skeletons, then the footage fades in —
|
||||
// no black rectangles and no pop-in on slow connections.
|
||||
const videoAlpha = useMemo(
|
||||
() => new Float32Array(layout.panels.length),
|
||||
[layout],
|
||||
);
|
||||
|
||||
// Per-clip decode bookkeeping, reused every frame so the budget allocates
|
||||
// nothing: closest panel edge, seconds since the clip last held a slot,
|
||||
// and a scratch permutation the budget sorts in place.
|
||||
const clipEdge = useMemo(
|
||||
() => new Float32Array(SEEDANCE_SHOWCASE.length).fill(FAR_EDGE),
|
||||
[],
|
||||
);
|
||||
const clipIdle = useMemo(
|
||||
() => new Float32Array(SEEDANCE_SHOWCASE.length),
|
||||
[],
|
||||
);
|
||||
const clipOrder = useMemo(() => SEEDANCE_SHOWCASE.map((_, i) => i), []);
|
||||
|
||||
useFrame((st3, delta) => {
|
||||
const dt = Math.min(delta, 0.05);
|
||||
const st = state.current;
|
||||
const d = drag.current;
|
||||
const mt = wallMotionTuner.read();
|
||||
const lk = wallLookTuner.read();
|
||||
|
||||
// Mount: the wall sweeps in fast and eases down to its walking pace.
|
||||
if (!st.started) {
|
||||
st.started = true;
|
||||
st.speed = mt.speed * mt.introBurst;
|
||||
}
|
||||
|
||||
// Offset advances in near-row pixels; deeper rows consume it scaled by
|
||||
// their parallax factor, so a drag maps 1:1 to the near row's motion.
|
||||
if (d?.dragging) {
|
||||
st.offset -= d.dx;
|
||||
d.dx = 0;
|
||||
st.wasDragging = true;
|
||||
} else {
|
||||
if (st.wasDragging && d) {
|
||||
st.wasDragging = false;
|
||||
st.speed = Math.max(-mt.dragMax, Math.min(mt.dragMax, d.vel));
|
||||
}
|
||||
st.offset += st.speed * dt;
|
||||
st.speed += (mt.speed - st.speed) * (1 - Math.exp(-1.1 * dt));
|
||||
}
|
||||
|
||||
// Pointer tilt, critically damped; unattended, a slow Lissajous drift
|
||||
// keeps the perspective alive.
|
||||
const p = pointer.current ?? { x: 0, y: 0, active: false };
|
||||
const t = st3.clock.elapsedTime;
|
||||
const nx = p.active
|
||||
? p.x / (size.width / 2)
|
||||
: Math.sin(t * 0.13) * 0.35;
|
||||
const ny = p.active
|
||||
? p.y / (size.height / 2)
|
||||
: Math.cos(t * 0.09) * 0.3;
|
||||
const k = 1 - Math.exp(-4 * dt);
|
||||
tilt.current.x += (nx - tilt.current.x) * k;
|
||||
tilt.current.y += (ny - tilt.current.y) * k;
|
||||
|
||||
const yaw =
|
||||
THREE.MathUtils.degToRad(mt.yawDeg) + tilt.current.x * mt.parallax;
|
||||
const pitch =
|
||||
THREE.MathUtils.degToRad(mt.pitchDeg) - tilt.current.y * mt.parallax * 0.6;
|
||||
rigRef.current?.rotation.set(pitch, yaw, 0);
|
||||
|
||||
const intro = smoothstep(0, 1, Math.min(1, t / 1.4));
|
||||
const dist = size.height / 2 / Math.tan(THREE.MathUtils.degToRad(FOV / 2));
|
||||
const cosY = Math.cos(yaw);
|
||||
const sinY = Math.sin(yaw);
|
||||
const dims = [lk.dimNear, lk.dimMid];
|
||||
clipEdge.fill(FAR_EDGE);
|
||||
|
||||
for (let i = 0; i < layout.panels.length; i++) {
|
||||
const g = groupRefs.current[i];
|
||||
if (!g) continue;
|
||||
const c = layout.panels[i];
|
||||
|
||||
// Odd rows ride the shared offset mirrored, so the top strip slides
|
||||
// against the near one (and a drag counter-scrolls them).
|
||||
const f = Math.pow(mt.speedStep, c.row) * (c.row % 2 ? -1 : 1);
|
||||
let lx = (c.x0 - st.offset * f) % c.length;
|
||||
if (lx < 0) lx += c.length;
|
||||
lx -= c.length / 2;
|
||||
g.position.set(lx, c.y, c.z);
|
||||
|
||||
// Screen-space vignette: project the panel center through the yaw and
|
||||
// fade panels out toward (and past) the viewport edges, so the wall
|
||||
// dissolves into the background instead of ending in a hard cut.
|
||||
const wx = cosY * lx + sinY * c.z;
|
||||
const wz = -sinY * lx + cosY * c.z;
|
||||
const projX = wx * (dist / (dist - wz));
|
||||
const edge = Math.abs(projX) / (size.width / 2);
|
||||
const vig = 1 - lk.edgeFade * smoothstep(0.72, 1.3, edge);
|
||||
if (edge < clipEdge[c.clip]) clipEdge[c.clip] = edge;
|
||||
|
||||
const ready = videos[c.clip].readyState >= 2 ? 1 : 0;
|
||||
videoAlpha[i] += (ready - videoAlpha[i]) * (1 - Math.exp(-3 * dt));
|
||||
const va = videoAlpha[i];
|
||||
|
||||
// Depth dimming: dark theme crushes deep rows toward black (the bg);
|
||||
// light theme washes them toward the paper via opacity instead.
|
||||
const dim = dims[c.row];
|
||||
const mat = materials[i];
|
||||
if (dark) {
|
||||
// Fade the unloaded panel out with alpha, not toward black: clips
|
||||
// now load on demand, and an opaque black rectangle reads as a hole
|
||||
// in the wall against the dark background.
|
||||
mat.color.setScalar(dim * vig);
|
||||
mat.opacity = intro * va;
|
||||
} else {
|
||||
// Light theme recedes via opacity toward the paper — but only for
|
||||
// depth: the near row keeps nearly full ink (sqrt softens its dim)
|
||||
// and the wash applies per-row, else everything goes pastel.
|
||||
mat.color.setScalar(1);
|
||||
mat.opacity =
|
||||
intro * Math.sqrt(dim) * vig * va * (1 - lk.washLight * c.row);
|
||||
}
|
||||
frameMaterials[i].opacity = lk.frameAlpha * vig * intro;
|
||||
}
|
||||
|
||||
st.cullTimer -= dt;
|
||||
if (st.cullTimer <= 0) {
|
||||
st.cullTimer = CULL_TICK_S;
|
||||
applyDecodeBudget(videos, clipEdge, clipIdle, clipOrder, CULL_TICK_S);
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<group ref={rigRef}>
|
||||
{layout.panels.map((c, i) => (
|
||||
<group
|
||||
key={i}
|
||||
ref={(el) => {
|
||||
groupRefs.current[i] = el;
|
||||
}}
|
||||
position={[0, c.y, c.z]}
|
||||
>
|
||||
<mesh material={materials[i]}>
|
||||
<planeGeometry args={[c.w, c.h]} />
|
||||
</mesh>
|
||||
{/* Hairline frame, matching the site's bordered viewport idiom. */}
|
||||
<lineSegments geometry={layout.frames[i]} material={frameMaterials[i]} />
|
||||
</group>
|
||||
))}
|
||||
</group>
|
||||
);
|
||||
}
|
||||
|
||||
// Hand the scarce decoders to the clips nearest the viewport and pause the
|
||||
// rest. Clips are ranked by their closest panel, so when the cap bites it is
|
||||
// always the outermost panels that freeze: the ones the edge vignette has
|
||||
// already dissolved. `elapsed` is the time since the previous call, not the
|
||||
// frame delta: this runs on the cull tick, not every frame.
|
||||
function applyDecodeBudget(
|
||||
videos: HTMLVideoElement[],
|
||||
clipEdge: Float32Array,
|
||||
clipIdle: Float32Array,
|
||||
clipOrder: number[],
|
||||
elapsed: number,
|
||||
) {
|
||||
clipOrder.sort((a, b) => clipEdge[a] - clipEdge[b]);
|
||||
let started = 0;
|
||||
for (let rank = 0; rank < clipOrder.length; rank++) {
|
||||
const clip = clipOrder[rank];
|
||||
const v = videos[clip];
|
||||
if (rank < MAX_DECODING && clipEdge[clip] < CULL_EDGE) {
|
||||
clipIdle[clip] = 0;
|
||||
// Nearest clips are first in the ranking, so the stagger always
|
||||
// spends its budget on the panels closest to the middle of frame.
|
||||
if (v.paused && started < RESUME_PER_TICK) {
|
||||
started++;
|
||||
v.play().catch(() => {});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
clipIdle[clip] += elapsed;
|
||||
if (clipIdle[clip] >= CULL_HOLD_S && !v.paused) v.pause();
|
||||
}
|
||||
}
|
||||
@@ -1,204 +1,27 @@
|
||||
"use client";
|
||||
|
||||
import { Component, useEffect, useRef, useState, type ReactNode } from "react";
|
||||
import { Canvas, useThree } from "@react-three/fiber";
|
||||
import * as THREE from "three";
|
||||
import { watchThemeColors, type ThemeColors } from "@/lib/theme-colors";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { heroWordmark } from "@/components/ruler/ruler-shared";
|
||||
import HeroWall, { createWallDrag } from "./hero-wall";
|
||||
|
||||
const WORDMARK_TEXT = "ARTCRAFT";
|
||||
const WORDMARK_FONT =
|
||||
"var(--font-archivo-black), var(--font-archivo), system-ui, sans-serif";
|
||||
|
||||
type PointerState = {
|
||||
x: number;
|
||||
y: number;
|
||||
active: boolean;
|
||||
};
|
||||
|
||||
// The hero: the wordmark set in the site's display type, floating over a
|
||||
// perspective render wall — two film-strip rows of Seedance takes forming
|
||||
// one yawed wall behind the word, drifting sideways at parallax speeds.
|
||||
// The type is real DOM text (crisp at any size, selectable by crawlers);
|
||||
// the wall is the WebGL layer behind it. Dragging anywhere throws the wall
|
||||
// with momentum; the pointer tilts it a few degrees. Server HTML,
|
||||
// reduced-motion visitors, and WebGL failures all get the plain wordmark
|
||||
// on the page background.
|
||||
export default function HeroWordmark() {
|
||||
const [ready, setReady] = useState(false);
|
||||
const [colors, setColors] = useState<ThemeColors | null>(null);
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const pointerRef = useRef<PointerState>({ x: 0, y: 0, active: false });
|
||||
const wallDragRef = useRef(createWallDrag());
|
||||
const [onScreen, setOnScreen] = useState(true);
|
||||
|
||||
// Gate: motion allowed and the tab actually foregrounded (a canvas born in
|
||||
// a hidden tab can come up blank).
|
||||
useEffect(() => {
|
||||
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
||||
let raf = 0;
|
||||
const tick = () => {
|
||||
if (!document.hidden) {
|
||||
setReady(true);
|
||||
return;
|
||||
}
|
||||
raf = requestAnimationFrame(tick);
|
||||
};
|
||||
raf = requestAnimationFrame(tick);
|
||||
return () => cancelAnimationFrame(raf);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!ready) return;
|
||||
return watchThemeColors(setColors);
|
||||
}, [ready]);
|
||||
|
||||
// Pointer in scene coordinates (origin at container center, y up), plus
|
||||
// drag bookkeeping for the wall: pressing anywhere grabs the wall and
|
||||
// throws it, while pointer movement tilts the whole perspective.
|
||||
useEffect(() => {
|
||||
const container = containerRef.current;
|
||||
if (!container) return;
|
||||
const dragLast = { x: 0, t: 0 };
|
||||
const onMove = (e: PointerEvent) => {
|
||||
const rect = container.getBoundingClientRect();
|
||||
pointerRef.current.x = e.clientX - rect.left - rect.width / 2;
|
||||
pointerRef.current.y = -(e.clientY - rect.top - rect.height / 2);
|
||||
pointerRef.current.active = true;
|
||||
const d = wallDragRef.current;
|
||||
if (d.dragging) {
|
||||
const now = performance.now();
|
||||
const dx = e.clientX - dragLast.x;
|
||||
const dt = Math.max(8, now - dragLast.t) / 1000;
|
||||
d.dx += dx;
|
||||
d.vel = d.vel * 0.75 + (-dx / dt) * 0.25;
|
||||
dragLast.x = e.clientX;
|
||||
dragLast.t = now;
|
||||
}
|
||||
};
|
||||
const onDown = (e: PointerEvent) => {
|
||||
onMove(e);
|
||||
const d = wallDragRef.current;
|
||||
d.dragging = true;
|
||||
d.dx = 0;
|
||||
d.vel = 0;
|
||||
dragLast.x = e.clientX;
|
||||
dragLast.t = performance.now();
|
||||
container.setPointerCapture(e.pointerId);
|
||||
};
|
||||
const onUp = () => {
|
||||
wallDragRef.current.dragging = false;
|
||||
};
|
||||
const onLeave = () => {
|
||||
pointerRef.current.active = false;
|
||||
wallDragRef.current.dragging = false;
|
||||
};
|
||||
container.addEventListener("pointermove", onMove);
|
||||
container.addEventListener("pointerdown", onDown);
|
||||
container.addEventListener("pointerup", onUp);
|
||||
container.addEventListener("pointerleave", onLeave);
|
||||
container.addEventListener("pointercancel", onLeave);
|
||||
return () => {
|
||||
container.removeEventListener("pointermove", onMove);
|
||||
container.removeEventListener("pointerdown", onDown);
|
||||
container.removeEventListener("pointerup", onUp);
|
||||
container.removeEventListener("pointerleave", onLeave);
|
||||
container.removeEventListener("pointercancel", onLeave);
|
||||
};
|
||||
}, []);
|
||||
|
||||
// The hero sits at the top of a long page. Once it scrolls away there is
|
||||
// nothing to look at, so stop the render loop and let the wall park its
|
||||
// video decoders. Same when the tab goes to the background, which the
|
||||
// observer alone would not catch.
|
||||
useEffect(() => {
|
||||
const container = containerRef.current;
|
||||
if (!container) return;
|
||||
let intersecting = true;
|
||||
const sync = () => setOnScreen(intersecting && !document.hidden);
|
||||
const observer = new IntersectionObserver(
|
||||
([entry]) => {
|
||||
intersecting = entry.isIntersecting;
|
||||
sync();
|
||||
},
|
||||
// Generous margin: the wall refills its decoders a few at a time, so
|
||||
// it needs a head start to be at full speed by the time a scroll back
|
||||
// up actually brings it into view.
|
||||
{ rootMargin: "600px 0px" },
|
||||
);
|
||||
observer.observe(container);
|
||||
document.addEventListener("visibilitychange", sync);
|
||||
return () => {
|
||||
observer.disconnect();
|
||||
document.removeEventListener("visibilitychange", sync);
|
||||
};
|
||||
}, []);
|
||||
|
||||
const active = ready && colors !== null;
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
className="relative h-[64svh] min-h-110 w-full touch-pan-y select-none"
|
||||
>
|
||||
{active && (
|
||||
<CanvasBoundary>
|
||||
<Canvas
|
||||
aria-hidden
|
||||
tabIndex={-1}
|
||||
// Video panels gain nothing from a 2x framebuffer; the hairline
|
||||
// frames are the only detail that wants the extra samples, and
|
||||
// 1.5x plus MSAA keeps them clean for a lot less fill.
|
||||
dpr={[1, 1.5]}
|
||||
frameloop={onScreen ? "always" : "never"}
|
||||
gl={{
|
||||
antialias: true,
|
||||
alpha: true,
|
||||
powerPreference: "high-performance",
|
||||
}}
|
||||
style={{ position: "absolute", inset: 0, pointerEvents: "none" }}
|
||||
>
|
||||
<FittedCamera />
|
||||
<HeroWall
|
||||
pointer={pointerRef}
|
||||
drag={wallDragRef}
|
||||
colors={colors}
|
||||
onScreen={onScreen}
|
||||
/>
|
||||
</Canvas>
|
||||
</CanvasBoundary>
|
||||
)}
|
||||
|
||||
{/* The wordmark, justified flush to the hero width (the big-type
|
||||
poster treatment) — per-letter spans instead of SVG text, because
|
||||
these very spans ARE the ruler's hero heading: the scroll ruler's
|
||||
HeadingFlow drives their transforms so the resting title peels
|
||||
tail-first onto the rail as the visitor scrolls out of the
|
||||
landing. Crawlable via role="img" + aria-label; z-40 so letters
|
||||
in transit ride above later sections (below the z-50 nav). */}
|
||||
<MorphWordmark />
|
||||
|
||||
{active && (
|
||||
<div
|
||||
aria-hidden
|
||||
className="pointer-events-none absolute inset-x-0 bottom-1.5 z-10 flex items-center justify-between px-6 md:px-10"
|
||||
>
|
||||
<p className="hud-label text-faint">Rendered with Seedance 2.5</p>
|
||||
<p className="hud-label hidden text-faint sm:block">drag to scroll</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// The justified wordmark letters. Font size is derived so the word's
|
||||
// natural advance run spans the 62% column exactly (the spacingAndGlyphs
|
||||
// stretch of the old SVG, minus the SVG). After layout, each letter's
|
||||
// natural center and advance are measured and published to the shared
|
||||
// heroWordmark channel for the ruler to drive; transforms are reset before
|
||||
// measuring so a mid-morph resize re-baselines cleanly.
|
||||
function MorphWordmark() {
|
||||
// The poster masthead: the wordmark justified flush across the hero rails in
|
||||
// the site's display type — per-letter spans instead of one text node,
|
||||
// because these very spans ARE the ruler's hero heading: HeadingFlow drives
|
||||
// their transforms so the resting title condenses into the top heading slot
|
||||
// as the visitor scrolls out of the landing. Crawlable via role="img" +
|
||||
// aria-label; z-40 so letters in transit ride above later sections (below
|
||||
// the z-50 nav). The bg-colored halos keep the type legible over any spiral
|
||||
// card passing beneath.
|
||||
//
|
||||
// Font size is derived so the word's natural advance run spans the box
|
||||
// exactly. After layout, each letter's natural center and advance are
|
||||
// measured and published to the shared heroWordmark channel for the ruler to
|
||||
// drive; transforms are reset before measuring so a mid-morph resize
|
||||
// re-baselines cleanly.
|
||||
export default function HeroMasthead() {
|
||||
const boxRef = useRef<HTMLDivElement>(null);
|
||||
const letterRefs = useRef<(HTMLSpanElement | null)[]>([]);
|
||||
const [fontPx, setFontPx] = useState(0);
|
||||
@@ -273,77 +96,42 @@ function MorphWordmark() {
|
||||
}, [fontPx]);
|
||||
|
||||
return (
|
||||
<div className="pointer-events-none absolute inset-0 z-40 flex items-center justify-center px-4 md:px-6">
|
||||
<div ref={boxRef} className="w-[62%]">
|
||||
<div
|
||||
role="img"
|
||||
aria-label={WORDMARK_TEXT}
|
||||
className="whitespace-pre text-ink-strong"
|
||||
style={{
|
||||
fontFamily: WORDMARK_FONT,
|
||||
fontSize: fontPx || "10.5vw",
|
||||
lineHeight: 1,
|
||||
}}
|
||||
>
|
||||
{WORDMARK_TEXT.split("").map((ch, i) => (
|
||||
<span
|
||||
key={i}
|
||||
aria-hidden
|
||||
ref={(el) => {
|
||||
letterRefs.current[i] = el;
|
||||
}}
|
||||
className="inline-block"
|
||||
style={{
|
||||
willChange: "transform, opacity",
|
||||
// Three stacked halos in the page background color: a tight
|
||||
// contact edge, a mid falloff, and a wide pool that sinks
|
||||
// the busiest footage behind the letters. Sized in vw so the
|
||||
// spread tracks the type as the wordmark scales.
|
||||
textShadow: [
|
||||
"0 0 0.6vw color-mix(in srgb, var(--bg) 92%, transparent)",
|
||||
"0 0.25vw 2.4vw color-mix(in srgb, var(--bg) 78%, transparent)",
|
||||
"0 0.4vw 5vw color-mix(in srgb, var(--bg) 55%, transparent)",
|
||||
].join(", "),
|
||||
}}
|
||||
>
|
||||
{ch}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<div ref={boxRef} className="pointer-events-none relative z-40 w-full">
|
||||
<div
|
||||
role="img"
|
||||
aria-label={WORDMARK_TEXT}
|
||||
className="whitespace-pre text-ink-strong"
|
||||
style={{
|
||||
fontFamily: WORDMARK_FONT,
|
||||
fontSize: fontPx || "13vw",
|
||||
lineHeight: 1,
|
||||
}}
|
||||
>
|
||||
{WORDMARK_TEXT.split("").map((ch, i) => (
|
||||
<span
|
||||
key={i}
|
||||
aria-hidden
|
||||
ref={(el) => {
|
||||
letterRefs.current[i] = el;
|
||||
}}
|
||||
className="inline-block"
|
||||
style={{
|
||||
willChange: "transform, opacity",
|
||||
// Three stacked halos in the page background color: a tight
|
||||
// contact edge, a mid falloff, and a wide pool that sinks
|
||||
// the busiest footage behind the letters. Sized in vw so the
|
||||
// spread tracks the type as the wordmark scales.
|
||||
textShadow: [
|
||||
"0 0 0.6vw color-mix(in srgb, var(--bg) 92%, transparent)",
|
||||
"0 0.25vw 2.4vw color-mix(in srgb, var(--bg) 78%, transparent)",
|
||||
"0 0.4vw 5vw color-mix(in srgb, var(--bg) 55%, transparent)",
|
||||
].join(", "),
|
||||
}}
|
||||
>
|
||||
{ch}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Perspective camera fitted so 1 world unit == 1 CSS pixel on the z=0 plane:
|
||||
// wall layout and pointer coordinates all agree. FOV must match hero-wall's
|
||||
// vignette projection.
|
||||
function FittedCamera() {
|
||||
const camera = useThree((s) => s.camera) as THREE.PerspectiveCamera;
|
||||
const size = useThree((s) => s.size);
|
||||
useEffect(() => {
|
||||
const fov = 30;
|
||||
const dist = size.height / 2 / Math.tan(THREE.MathUtils.degToRad(fov / 2));
|
||||
camera.fov = fov;
|
||||
camera.position.set(0, 0, dist);
|
||||
camera.near = Math.max(1, dist - 1200);
|
||||
camera.far = dist + 1200;
|
||||
camera.updateProjectionMatrix();
|
||||
}, [camera, size.height]);
|
||||
return null;
|
||||
}
|
||||
|
||||
class CanvasBoundary extends Component<
|
||||
{ children: ReactNode },
|
||||
{ failed: boolean }
|
||||
> {
|
||||
state = { failed: false };
|
||||
|
||||
static getDerivedStateFromError() {
|
||||
return { failed: true };
|
||||
}
|
||||
|
||||
render() {
|
||||
return this.state.failed ? null : this.props.children;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +1,52 @@
|
||||
import { AppleIcon, MonitorIcon } from "lucide-react";
|
||||
import { SOCIAL_LINKS, WEBAPP_URL } from "@/lib/links";
|
||||
import { HERO_VIDEO_URL } from "@/lib/landing-data";
|
||||
import { HERO_VIDEO_URL, SEEDANCE_SHOWCASE } from "@/lib/landing-data";
|
||||
import { GitHubIcon } from "@/components/icons";
|
||||
import { Button } from "@/components/ui";
|
||||
import HeroWordmark from "./hero-wordmark";
|
||||
import HeroMasthead from "./hero-wordmark";
|
||||
import HeroSpiral from "./hero-spiral";
|
||||
import HeroViewport from "./hero-viewport";
|
||||
|
||||
export default function Hero() {
|
||||
return (
|
||||
<section id="hero" className="relative">
|
||||
{/* Full-bleed hero — crisp display-type wordmark over the render
|
||||
wall: rows of Seedance takes forming one perspective wall that
|
||||
drifts behind the word and answers the cursor. */}
|
||||
<HeroWordmark />
|
||||
{/* Single-stage poster: everything that sells fits in the first
|
||||
viewport — masthead, headline, CTAs, proof line — over the
|
||||
blueprint spiral. The spiral bleeds full-bleed past the content
|
||||
rails; the copy respects them. */}
|
||||
<div className="relative flex min-h-[calc(100svh-3rem)] flex-col">
|
||||
<HeroSpiral clips={SEEDANCE_SHOWCASE} />
|
||||
|
||||
<div className="relative mx-auto max-w-[1280px] border-x border-line">
|
||||
<div className="flex items-center justify-between gap-4 border-y border-line px-6 py-3 md:px-10">
|
||||
<p className="hud-label text-muted">Open-source AI studio</p>
|
||||
<p className="hud-label text-accent-ink">
|
||||
Now with Seedance 2.5, Nano Banana 2 & more
|
||||
</p>
|
||||
</div>
|
||||
<div className="pointer-events-none relative z-10 mx-auto flex w-full max-w-[1280px] flex-1 flex-col border-x border-line px-6 pt-8 md:px-10 md:pt-12">
|
||||
<HeroMasthead />
|
||||
|
||||
<div data-reveal-group className="px-6 pt-12 pb-10 md:px-10">
|
||||
<h1
|
||||
data-reveal
|
||||
className="max-w-3xl font-display text-4xl font-medium leading-[1.02] tracking-[-0.035em] text-ink-strong sm:text-5xl md:text-6xl"
|
||||
{/* The spiral's field — the drawing owns this space. */}
|
||||
<div className="flex-1" />
|
||||
|
||||
<div
|
||||
data-reveal-group
|
||||
className="pointer-events-auto max-w-xl pb-10 md:pb-14"
|
||||
>
|
||||
Controllable AI{" "}
|
||||
<span className="font-serif italic font-normal text-muted">
|
||||
for artists.
|
||||
</span>
|
||||
</h1>
|
||||
<h1
|
||||
data-reveal
|
||||
className="font-display text-3xl font-medium leading-[1.05] tracking-[-0.03em] text-ink-strong sm:text-4xl md:text-5xl"
|
||||
>
|
||||
Controllable AI{" "}
|
||||
<span className="font-serif italic font-normal text-muted">
|
||||
for artists.
|
||||
</span>
|
||||
</h1>
|
||||
|
||||
<div className="mt-8 flex flex-col gap-8 md:flex-row md:items-end md:justify-between">
|
||||
<p
|
||||
data-reveal
|
||||
className="max-w-md text-lg leading-relaxed text-muted"
|
||||
className="mt-5 max-w-md text-lg leading-relaxed text-muted"
|
||||
>
|
||||
Artists need and deserve unparalleled control and precision.
|
||||
ArtCraft’s got you covered — compose in real 3D, then
|
||||
render with AI.
|
||||
</p>
|
||||
<div data-reveal className="flex flex-wrap items-center gap-3">
|
||||
|
||||
<div data-reveal className="mt-7 flex flex-wrap items-center gap-3">
|
||||
<Button href="/download" size="lg">
|
||||
<AppleIcon aria-hidden className="h-4 w-4" />
|
||||
<MonitorIcon aria-hidden className="h-4 w-4" />
|
||||
@@ -52,28 +56,40 @@ export default function Hero() {
|
||||
Use on web
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
data-reveal
|
||||
className="mt-8 flex flex-wrap items-center gap-x-6 gap-y-2"
|
||||
>
|
||||
<a
|
||||
href={SOCIAL_LINKS.GITHUB}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="hud-label flex items-center gap-1.5 text-faint hover:text-ink"
|
||||
<div
|
||||
data-reveal
|
||||
className="mt-7 flex flex-wrap items-center gap-x-6 gap-y-2"
|
||||
>
|
||||
<GitHubIcon className="h-3.5 w-3.5" />
|
||||
Open source on GitHub
|
||||
</a>
|
||||
<p className="hud-label text-faint">macOS · Windows · Web</p>
|
||||
<p className="hud-label text-faint">No subscription required</p>
|
||||
<a
|
||||
href={SOCIAL_LINKS.GITHUB}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="hud-label flex items-center gap-1.5 text-faint hover:text-ink"
|
||||
>
|
||||
<GitHubIcon className="h-3.5 w-3.5" />
|
||||
Open source on GitHub
|
||||
</a>
|
||||
<p className="hud-label text-faint">macOS · Windows · Web</p>
|
||||
<p className="hud-label text-faint">No subscription required</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="relative mx-auto max-w-[1280px] border-x border-line">
|
||||
{/* Announce strip — the fold line under the poster. */}
|
||||
<div className="relative flex items-center justify-between gap-4 border-y border-line px-6 py-3 md:px-10">
|
||||
<span aria-hidden className="tick -top-[6px] -left-[6px]" />
|
||||
<span aria-hidden className="tick -top-[6px] -right-[5px]" />
|
||||
<p className="hud-label text-muted">Open-source AI studio</p>
|
||||
<p className="hud-label text-accent-ink">
|
||||
Now with Seedance 2.5, Nano Banana 2 & more
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Viewport frame — the product-demo stage: blocking vs. AI render. */}
|
||||
<figure className="relative border-t border-line">
|
||||
<figure className="relative">
|
||||
<div className="flex items-center justify-between gap-4 border-b border-line px-6 py-2 md:px-10">
|
||||
<figcaption className="hud-label text-faint">
|
||||
Viewport — scene 01
|
||||
|
||||
Reference in new issue
Block a user