Skip to content
Myr

Fill the music box's plain faces with the parts a real one has (a tune card inside the back wall, a nameplate and a screw per section on the comb's block, an inlay on the far wall, a ruler along the bench's front), fade each answer in at the intake and the press's copy out as it pins it, and ease a stage's colour in over 160 ms

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by oscabriel · committed by oscabriel · parent 6f67328 · Browse files · 6 files+143 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+143 added−8 removed

  • other:+143 added−8 removed

6 files+143 added−8 removed

modified:apps/web/src/features/landing/music-box/art.tsx+3 added-3 removed
122 unmodified lines
123const Stray = ({ frame }: { readonly frame: ReturnType<typeof liveFrame> }) => (124 <g125 data-fault={frame.fault ? "" : undefined}126 data-part="stray"127 opacity={frame.strayOpacity}127 opacity={frame.strayOpacity.toFixed(3)}128 transform={frame.stray}129 >130 <Marks marks={MOVING.strayStrip} />131 </g>
66 unmodified lines
198 <Marks marks={STATIC.pillars} />199 <Marks marks={STATIC.railBack} />200 <g data-part="carriage" transform={frame.carriage}>201 <Marks marks={MOVING.carriage} />202 <g data-part="strip" opacity={pose.round === 2 ? 1 : 0}>202 <g data-part="strip" opacity={frame.stripOpacity.toFixed(3)}>203 <Marks marks={MOVING.strip} />204 </g>205 </g>206 <g data-part="carriage-slot">
43 unmodified lines
250 <Marks marks={STATIC.trayFronts} />251 <g data-part="arm-back">252 <Marks marks={armBack(pose.arm)} />253 </g>254 <g data-part="arm-strip" opacity={pose.holding ? 1 : 0}>254 <g data-part="arm-strip" opacity={frame.heldOpacity.toFixed(3)}>255 <Marks marks={armStrip(pose.arm)} />256 </g>257 <g data-part="arm-front">258 <Marks marks={armFront(pose.arm)} />
20 unmodified lines
modified:apps/web/src/features/landing/music-box/frame.ts+5 added-1 removed
modified:apps/web/src/features/landing/music-box/model.ts+7 added-1 removed
44 unmodified lines
45 readonly fresh: number;46 /** The claim's clip: 0 off the ruler, 1 on it. */47 readonly claim: number;48 readonly carriage: number;49 /** How far the carriage's answer has come in at the intake, 0 to 1. */50 readonly arrive: number;51 /** Which answer the carriage holds: none, the first or the second. */52 readonly round: 0 | 1 | 2;53 /** The first answer's slide off the carriage into its tray, 0 to 1, and its fade at the reset. */54 readonly drop: number;
278 unmodified lines
333 const fixed = smooth(PRESSED - 0.2, PRESSED + 0.2, t);334335 return {336 arm: armAt(t),337 arrive:338 t >= ROUND_TWO339 ? smooth(ROUND_TWO, ROUND_TWO + 0.35, t)340 : smooth(ROUND_ONE, ROUND_ONE + 0.35, t),341 ask: cycle,342 bell: pulse(arrival(5) + 0.2, 0.05, 0.6, t),343 carriage: carriageAt(t),344 claim:
8 unmodified lines
353 pulse(arrival(3) + 0.42, 0.12, 0.2, t),354 fixed,355 flags: flagsAt(t),356 fresh: fixed * (1 - smooth(RESET - 2, RESET, t)),351 holding: between(GRIP, PRESSED + 0.05, t),357 holding: between(GRIP, PRESSED + 0.25, t),358 phase: words.phase,359 printing: smooth(PRESSED, PRESSED + 0.6, t),360 ratchet: cycle + smooth(PRESSED + 0.3, PRESSED + 0.45, t),361 readout: words.text,
26 unmodified lines
modified:apps/web/src/features/landing/music-box/music-box.tsx+2 added-2 removed
103 unmodified lines
104 set(parts.one("claim"), "transform", frame.claim);105 set(parts.one("claim"), "opacity", frame.claimOpacity.toFixed(3));106 set(parts.one("flag"), "transform", frame.flag);107 set(parts.one("carriage"), "transform", frame.carriage);108 set(parts.one("strip"), "opacity", pose.round === 2 ? "1" : "0");108 set(parts.one("strip"), "opacity", frame.stripOpacity.toFixed(3));109110 const stray = parts.one("stray");111112 if (stray !== null) {
24 unmodified lines
137 repaint(parts.one("arm-strip"), armStrip(pose.arm));138 repaint(parts.one("arm-front"), armFront(pose.arm));139 }140141 set(parts.one("arm-strip"), "opacity", pose.holding ? "1" : "0");141 set(parts.one("arm-strip"), "opacity", frame.heldOpacity.toFixed(3));142 set(parts.one("entries"), "d", tapeEntries(pose));143144 if (parts.readout !== null && parts.readout.textContent !== pose.readout) {145 parts.readout.textContent = pose.readout;
247 unmodified lines
modified:apps/web/src/features/landing/music-box/parts.ts+117 added
144 unmodified lines
145 tone146 );147148/** The bench: feet, a bevelled top with a groove, corner screws and a label plate. */149/** A ruler along the bench's front edge, ticked every 4 units. */150const RULER: Plan = {151 d: 4.6,152 r: 0.8,153 w: 244,154 x: -146,155 y: BASE.y + BASE.d - 10.6,156};157158const rulerTicks = ticksAlongX(159 Array.from({ length: 60 }, (_, index) => RULER.x + 4 + index * 4),160 5,161 RULER.y + 0.4,162 0.6,163 [1.4, 2.8],164 C165);166167export const bench = (): readonly Mark[] => {168 const feet = cornersOf(BASE, 24).toSorted(169 (a, b) => a[0] * C.cosA + a[1] * C.sinA - (b[0] * C.cosA + b[1] * C.sinA)170 );
18 unmodified lines
189 }),190 line(planOutline(insetPlan(BASE, 5), 0, C, 8), "lo"),191 line(corner.map((point) => ringOnTop(point, 2.2, 0, C, 16)).join(""), "lo"),192 screws(corner.map(([x, y]) => [x, y, 0])),193 solid(slab(RULER, 0, 0.6, C, { steps: 2 }), "lo", { crease: "none" }),194 line(rulerTicks.minor, "lo"),195 line(rulerTicks.major, "mid"),196 screws(197 [198 [RULER.x + 2, RULER.y + RULER.d / 2, 0.6],199 [RULER.x + RULER.w - 2, RULER.y + RULER.d / 2, 0.6],200 ],201 0.42202 ),203 solid(slab(label, 0, 0.8, C, { steps: 2 }), "lo", { crease: "none" }),204 line(planOutline(insetPlan(label, 1.6), 0.8, C, 2), "faint"),205 line(206 onTop(
147 unmodified lines
354 screws([low, high], 0.55),355 ];356};357358/** The tune card pinned inside the back wall, as every cylinder box has one: printed lines. */359const tuneCard = (): readonly Mark[] => {360 const face = CASE.y + WALL + 0.4;361 const from = CASE.x + WALL + 8;362 const to = from + 26;363364 const rule = (z: number, length: number) =>365 line(366 polyline(367 [368 [from + 3, face, z],369 [from + 3 + length, face, z],370 ],371 C372 ),373 "lo",374 { free: true }375 );376377 return [378 box([from, CASE.y + WALL, 22], [to, face, 50], "hi"),379 rule(45.5, 16),380 rule(41.5, 20),381 rule(38, 13),382 rule(34.5, 19),383 rule(31, 9),384 rule(27.5, 17),385 screws(386 [387 [from + 2, face, 48],388 [to - 2, face, 48],389 ],390 0.45391 ),392 ];393};394395/** The case behind the movement: floor, back wall, far end wall, bedplate. */396export const caseBack = (): readonly Mark[] => {397 const floor = CASE;398 const back: Plan = { d: WALL, r: 1, w: CASE.w, x: CASE.x, y: CASE.y };
26 unmodified lines
425 {426 inner: [line(sideSeam(end, WALL_TOP - 9, C, 3), "faint")],427 }428 ),429 line(430 polyline(431 [432 [CASE.x + WALL, CASE.y + WALL + 6, CASE_FLOOR + 7],433 [CASE.x + WALL, CASE.y + CASE.d - 6, CASE_FLOOR + 7],434 [CASE.x + WALL, CASE.y + CASE.d - 6, WALL_TOP - 14],435 [CASE.x + WALL, CASE.y + WALL + 6, WALL_TOP - 14],436 ],437 C,438 true439 ),440 "lo"441 ),442 ...tuneCard(),443 solid(444 slab(BED, CASE_FLOOR, BED_TOP - CASE_FLOOR, C, { bevel: 0.6, steps: 3 }),445 "lo"446 ),
269 unmodified lines
716 {717 inner: [line(sideSeam(block, COMB_Z - 5, C, 3), "faint")],718 }719 ),720 box([from + 10, COMB_BACK, 13], [from + 34, COMB_BACK + 0.5, 21.5], "hi"),721 line(722 polyline(723 [724 [from + 13, COMB_BACK + 0.5, 19],725 [from + 29, COMB_BACK + 0.5, 19],726 ],727 C728 ),729 "lo",730 { free: true }731 ),732 line(733 polyline(734 [735 [from + 13, COMB_BACK + 0.5, 16.5],736 [from + 24, COMB_BACK + 0.5, 16.5],737 ],738 C739 ),740 "lo",741 { free: true }742 ),743 screws(744 [745 [from + 12, COMB_BACK + 0.5, 21],746 [from + 32, COMB_BACK + 0.5, 21],747 ...Array.from(748 { length: TEETH / TEETH_PER_SECTION },749 (_section, section): Point => [750 (sectionFrom(section) + sectionTo(section)) / 2,751 COMB_BACK,752 COMB_Z - 2.5,753 ]754 ),755 ],756 0.45757 ),758 ...Array.from({ length: 8 }, (_, tooth) =>759 box(760 [761 toothX(tooth) - TOOTH_W / 2 + 0.2,
979 unmodified lines
modified:apps/web/src/styles.css+9 added-1 removed
889 unmodified lines
890 stroke: var(--mbx-lit);891 stroke-width: 1.6px;892}893894/* A state's colour, beside the readout's word for it. */894/* A state's colour, beside the readout's word for it, eased in as the stage reports it. */895.mbx [data-flag] path,896.mbx [data-part="bell"] path,897.mbx [data-part="tooth"] path {898 transition:899 fill 160ms ease-out,900 stroke 160ms ease-out;901}902903.mbx [data-state="landed"] :is(.mbx-fill, .mbx-shade, .mbx-top),904.mbx [data-state="refused"] :is(.mbx-fill, .mbx-shade, .mbx-top),905.mbx [data-state="sealed"] :is(.mbx-fill, .mbx-shade, .mbx-top),906.mbx [data-state="checking"] :is(.mbx-fill, .mbx-shade, .mbx-top) {
95 unmodified lines