Skip to content

Commit 42eecf5

Browse files
feat(landing): animate the chapter art, and drive it from scroll
The restrained pass left the props with parallax and nothing else, so they still read as static furniture. Two layers of motion now, and neither costs a listener or a rAF loop. CONTINUOUS, in CSS keyframes: the radar needle actually sweeps, contacts pulse on a stagger, the trace's dashes flow so the path reads as a live signal rather than a drawn line, and rings ping outward. Keyframes rather than JS because the resting state of the page has to be composed even where rAF never fires. SCROLL-DRIVEN, straight from --sc-p: the engine publishes each act's progress on the act element and custom properties inherit, so CSS reads it with no bridge at all. The sweep gains rotation as the chapter travels, and the reading rides the trace via offset-path with offset-distance calc'd from progress. Verified: --sc-p reaches the dot (0.0338 -> 0.3033) and it moves 195px along the curve. Two things worth recording. transform-box: view-box is what makes 50% 50% mean the centre of the viewBox rather than the element's own tight bounding box, which for a needle drawn outward from the centre is a different point entirely. And the scroll rotation needs its own group wrapping the idle one, because a CSS animation and a static transform cannot share an element. prefers-reduced-motion stills all of it, checked rather than assumed: the spin holds its frame and the scroll rotation goes neutral, so nothing moves for a reader who asked for stillness. Three shoots clean, 11 routes 200, lint level at 17. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 841dd65 commit 42eecf5

2 files changed

Lines changed: 105 additions & 21 deletions

File tree

‎frontend/src/app/globals.css‎

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,67 @@ html.dark .asset-slot {
12131213
}
12141214
.sr-drift { animation: sr-drift 11s ease-in-out infinite; }
12151215

1216+
/* ── Chapter art: continuous motion, plus a scroll-driven layer ──
1217+
The engine publishes each act's progress as --sc-p on the act element, and
1218+
custom properties inherit, so the art reads it in pure CSS. No extra rAF, no
1219+
listener, and the continuous half still runs if scripts never execute. */
1220+
1221+
/* The sweep actually sweeps. transform-box: view-box makes 50% 50% mean the
1222+
centre of the viewBox rather than the element's own tight bounding box,
1223+
which for a needle drawn from the centre outward is not the same point. */
1224+
@keyframes art-sweep { to { transform: rotate(360deg); } }
1225+
.art-spin {
1226+
transform-box: view-box;
1227+
transform-origin: 50% 50%;
1228+
animation: art-sweep 14s linear infinite;
1229+
}
1230+
/* Scroll adds travel on top of the idle rotation. Two nested groups because a
1231+
CSS animation and a static transform cannot share one element. */
1232+
.art-scroll-rot {
1233+
transform-box: view-box;
1234+
transform-origin: 50% 50%;
1235+
transform: rotate(calc(var(--sc-p, 0) * 90deg));
1236+
}
1237+
1238+
/* Contacts breathe, staggered so they do not pulse in unison. */
1239+
@keyframes art-pulse {
1240+
0%, 100% { transform: scale(1); opacity: 0.9; }
1241+
50% { transform: scale(1.35); opacity: 1; }
1242+
}
1243+
.art-pulse {
1244+
transform-box: fill-box;
1245+
transform-origin: 50% 50%;
1246+
animation: art-pulse 4.5s ease-in-out infinite;
1247+
}
1248+
.art-pulse-2 { animation-delay: -1.6s; }
1249+
.art-pulse-3 { animation-delay: -3.1s; }
1250+
1251+
/* The dashes flow along the trace, so the path reads as a live signal rather
1252+
than a drawn line. */
1253+
@keyframes art-flow { to { stroke-dashoffset: -34; } }
1254+
.art-flow { animation: art-flow 2.6s linear infinite; }
1255+
1256+
/* The reading travels the trace as you scroll: offset-distance is driven
1257+
straight from act progress. This is the scroll animation proper. */
1258+
.art-travel {
1259+
offset-path: path("M10 250 C 150 250, 210 120, 340 110 S 500 60, 596 20");
1260+
offset-distance: calc(var(--sc-p, 0) * 100%);
1261+
offset-rotate: 0deg;
1262+
}
1263+
1264+
/* The rings expand outward like a ping. */
1265+
@keyframes art-ping {
1266+
0% { transform: scale(0.72); opacity: 0.55; }
1267+
70% { opacity: 0; }
1268+
100% { transform: scale(1.25); opacity: 0; }
1269+
}
1270+
.art-ping {
1271+
transform-box: view-box;
1272+
transform-origin: 50% 50%;
1273+
animation: art-ping 6s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
1274+
}
1275+
.art-ping-2 { animation-delay: -3s; }
1276+
12161277
/* Chapter content sits above its art. Excluding .ch-art matters: the rule
12171278
sets `position: relative`, which overrode the art layer's own `absolute
12181279
inset-0` and collapsed it to a zero-height box in flow. */
@@ -1221,5 +1282,13 @@ html.dark .asset-slot {
12211282
.ch-beige > *:not(.ch-art) { position: relative; z-index: 1; }
12221283

12231284
@media (prefers-reduced-motion: reduce) {
1224-
.sr-drift { animation: none; }
1285+
.sr-drift,
1286+
.art-spin,
1287+
.art-pulse,
1288+
.art-flow,
1289+
.art-ping { animation: none; }
1290+
/* The scroll-driven pieces hold at their start rather than tracking the
1291+
wheel, so nothing moves under a reader who asked for stillness. */
1292+
.art-scroll-rot { transform: none; }
1293+
.art-travel { offset-distance: 0%; }
12251294
}

‎frontend/src/components/landing/ChapterArt.tsx‎

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,22 @@
66
* are what stops a flat cream page reading as static.
77
*
88
* We have no illustrator, so ours come from StackRadar's own vocabulary rather
9-
* than borrowed characters: a radar sweep, a signal trace, a quiet ring.
9+
* than borrowed characters: a radar sweep, a signal trace, a ping.
1010
*
11-
* RESTRAINT IS THE POINT. The reference measures 0.031 colourfulness — it is
12-
* ~97% neutral and the props punctuate a mostly empty canvas. A first pass
13-
* here put big saturated dots across the headline and read as confetti. Each
14-
* variant is now ONE prop, held to the outer edge, clear of the text column.
11+
* TWO LAYERS OF MOTION, and neither costs a listener:
12+
* - Continuous, in CSS keyframes — the sweep rotates, contacts pulse, dashes
13+
* flow. This runs even where rAF never fires, so the resting state of the
14+
* page is composed rather than blank.
15+
* - Scroll-driven, straight from `--sc-p`. The engine publishes each act's
16+
* progress on the act element and custom properties inherit, so CSS reads
17+
* it directly: the sweep gains travel and the reading rides the trace.
1518
*
16-
* Mechanics:
17-
* - `data-sc-parallax` is the engine's own device, so the scroll response
18-
* costs no extra listener and stops when the engine does.
19-
* - The drift is a CSS keyframe, so it runs where rAF never fires and the
20-
* resting state is a composed frame rather than a blank one.
21-
* - Server component, aria-hidden, pointer-events-none: atmosphere only.
19+
* RESTRAINT IS STILL THE POINT. The reference measures 0.031 colourfulness —
20+
* ~97% neutral, props punctuating a mostly empty canvas. An earlier pass put
21+
* big saturated dots across the headline and read as confetti. Each variant is
22+
* ONE prop, held to the outer margin, clear of the text column.
23+
*
24+
* Server component, aria-hidden, pointer-events-none: atmosphere only.
2225
*/
2326
export default function ChapterArt({
2427
variant,
@@ -32,8 +35,6 @@ export default function ChapterArt({
3235
style={{ zIndex: 0 }}
3336
>
3437
{variant === "sweep" && (
35-
/* Radar rings, mostly off the right edge. The type owns the left two
36-
thirds, so the sweep never crosses a line of copy. */
3738
<svg
3839
data-sc-parallax="-0.14"
3940
className="absolute -right-[9vw] top-[16vh] hidden h-[68vh] w-[68vh] lg:block"
@@ -52,31 +53,44 @@ export default function ChapterArt({
5253
strokeDasharray={i === 1 ? "3 9" : undefined}
5354
/>
5455
))}
55-
<path d="M200 200 L200 14" stroke="#8ED462" strokeWidth="5" strokeLinecap="round" />
56+
57+
{/* A ping expanding out of the centre. */}
58+
<circle className="art-ping" cx="200" cy="200" r="140" stroke="#8ED462" strokeOpacity="0.5" strokeWidth="1.5" />
59+
<circle className="art-ping art-ping-2" cx="200" cy="200" r="140" stroke="#8ED462" strokeOpacity="0.4" strokeWidth="1.5" />
60+
61+
{/* Scroll rotation wraps the idle rotation: a CSS animation and a
62+
static transform cannot live on the same element. */}
63+
<g className="art-scroll-rot">
64+
<g className="art-spin">
65+
<path d="M200 200 L200 14" stroke="#8ED462" strokeWidth="5" strokeLinecap="round" />
66+
</g>
67+
</g>
68+
5669
<circle cx="200" cy="200" r="9" fill="#8ED462" />
57-
<circle cx="316" cy="126" r="13" fill="#FF705D" />
70+
<circle className="art-pulse" cx="316" cy="126" r="13" fill="#FF705D" />
71+
<circle className="art-pulse art-pulse-2" cx="92" cy="286" r="8" fill="#2BA0FF" />
5872
</svg>
5973
)}
6074

6175
{variant === "traces" && (
62-
/* The "-trace" idea in our terms: one dotted signal path arcing along
63-
the bottom edge, well below the copy. */
6476
<svg
6577
data-sc-parallax="-0.1"
6678
className="absolute -left-[3vw] bottom-[-2vh] hidden h-[42vh] w-[52vw] lg:block"
6779
viewBox="0 0 600 300"
6880
fill="none"
69-
preserveAspectRatio="none"
7081
>
7182
<path
83+
className="art-flow"
7284
d="M10 250 C 150 250, 210 120, 340 110 S 500 60, 596 20"
7385
stroke="var(--c-ink)"
7486
strokeOpacity="0.3"
7587
strokeWidth="2.5"
7688
strokeDasharray="1 16"
7789
strokeLinecap="round"
7890
/>
79-
<circle cx="340" cy="110" r="11" fill="#2BA0FF" />
91+
{/* The reading itself, riding the trace as the chapter scrolls. */}
92+
<circle className="art-travel" cx="0" cy="0" r="11" fill="#2BA0FF" />
93+
<circle className="art-pulse" cx="340" cy="110" r="7" fill="#8ED462" />
8094
</svg>
8195
)}
8296

@@ -89,7 +103,8 @@ export default function ChapterArt({
89103
>
90104
<circle cx="200" cy="200" r="150" stroke="var(--c-ink)" strokeOpacity="0.14" strokeWidth="1" />
91105
<circle cx="200" cy="200" r="96" stroke="var(--c-ink)" strokeOpacity="0.12" strokeWidth="1" strokeDasharray="3 9" />
92-
<circle cx="200" cy="200" r="12" fill="#C3AEFF" />
106+
<circle className="art-ping" cx="200" cy="200" r="150" stroke="#C3AEFF" strokeOpacity="0.45" strokeWidth="1.5" />
107+
<circle className="art-pulse" cx="200" cy="200" r="12" fill="#C3AEFF" />
93108
</svg>
94109
)}
95110
</div>

0 commit comments

Comments
 (0)