Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
First-run intro animation, handover to Welcome, and onboarding page entrances (CHOO-3236) (#942)
Louis Amaudruzbd3fb62ed30f
diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/AgentAvatar.tsx b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/AgentAvatar.tsxnew file mode 100644index 000000000..749a9eaff--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/AgentAvatar.tsx@@ -0,0 +1,194 @@+import {+ motion,+ type MotionValue,+ useMotionValue,+ useMotionValueEvent,+ useTransform,+} from 'motion/react';+import { AVATARS, EJECT, PALETTE, eyeState, type AgentKey } from './timeline';++/*+ * The two agents, inlined as real SVG.+ *+ * They are NOT <img> tags: each eye is its own <path> with `transform-box: fill-box`, so+ * pupil saccades (translate) and blinks (scaleY) are driven per-eye from the master clock.+ * The Figma export's #393939 backing rect and the two huge "Section 2" artboard paths are+ * stripped — only the body and the two eyes are real geometry.+ */++interface AgentShape {+ body: string;+ eyes: string[];+}++const SHAPES: Record<AgentKey, AgentShape> = {+ writer: {+ // shape-pill — visible bounds 60.8..451.2 x 129.8..382.2 inside the 512 box+ body:+ 'M324.163 129.799L184.016 131.939C114.908 132.994 59.7401 189.872 60.7952 258.98C61.8503 ' ++ '328.088 118.729 383.256 187.837 382.201L327.983 380.061C397.091 379.006 452.259 322.128 ' ++ '451.204 253.02C450.149 183.912 393.27 128.744 324.163 129.799Z',+ eyes: [+ 'M187.789 297.107C204.383 296.854 217.63 283.197 217.376 266.602C217.123 250.008 203.466 ' ++ '236.762 186.871 237.015C170.277 237.268 157.031 250.926 157.284 267.52C157.537 284.114 ' ++ '171.195 297.361 187.789 297.107Z',+ 'M325.433 295.006C342.028 294.753 355.274 281.095 355.021 264.501C354.768 247.907 341.11 ' ++ '234.66 324.516 234.913C307.922 235.167 294.675 248.824 294.928 265.418C295.182 282.013 ' ++ '308.839 295.259 325.433 295.006Z',+ ],+ },+ builder: {+ // shape-diamond — visible bounds 66.5..445.5 both axes inside the 512 box+ body:+ 'M189.52 109.065C224.545 68.9826 262.098 66.4538 302.181 101.479L402.935 189.52C443.017 ' ++ '224.544 445.546 262.098 410.521 302.181L322.481 402.935C287.456 443.017 249.902 445.546 ' ++ '209.819 410.521L109.065 322.48C68.9829 287.455 66.4541 249.902 101.479 209.819L189.52 109.065Z',+ eyes: [+ 'M231.378 260.638C230.763 251.505 222.861 244.6 213.728 245.215C204.595 245.83 197.69 ' ++ '253.732 198.305 262.865L200.051 288.787C200.666 297.92 208.568 304.825 217.701 304.21C226.834 ' ++ '303.595 233.739 295.693 233.124 286.56L231.378 260.638Z',+ 'M314.095 255.068C313.48 245.935 305.578 239.03 296.445 239.645C287.312 240.26 280.407 ' ++ '248.162 281.022 257.295L282.767 283.217C283.382 292.35 291.285 299.255 300.417 298.64C309.55 ' ++ '298.025 316.455 290.123 315.84 280.99L314.095 255.068Z',+ ],+ },+};++const EYE_STYLE = { transformBox: 'fill-box', transformOrigin: 'center' } as const;++/*+ * The power-up smile.+ *+ * The eye paths above are closed blobs, so their centres are recorded here and the smile is+ * generated from them — move the art and the smile follows. Each eye becomes one arc that+ * peaks upward, stroked with round caps so it reads as a happy closed eye rather than a+ * drawn line. `w` is the arc's half-width, which is the pupil's own half-width for the+ * writer's circles and a little wider than the builder's narrow ovals.+ */+interface SmileEye {+ cx: number;+ cy: number;+ w: number;+}++interface SmileGeom {+ stroke: number;+ eyes: SmileEye[];+}++const SMILE_GEOM: Record<AgentKey, SmileGeom> = {+ writer: {+ stroke: 17,+ eyes: [+ { cx: 187.3, cy: 267.2, w: 30 },+ { cx: 325.0, cy: 265.0, w: 30 },+ ],+ },+ builder: {+ stroke: 15,+ eyes: [+ { cx: 215.7, cy: 274.7, w: 24 },+ { cx: 298.4, cy: 269.1, w: 24 },+ ],+ },+};++// A quadratic peaks halfway to its control point, so the control sits twice as far above+// centre as the peak does: ends 7 below, peak 11 above.+function smileArc({ cx, cy, w }: SmileEye): string {+ const ends = cy + 7;+ return `M${cx - w} ${ends}Q${cx} ${2 * (cy - 11) - ends} ${cx + w} ${ends}`;+}++// capitalised local so eslint sees `motion` used (this config has no jsx-uses-vars for+// member expressions) and so JSX treats it as a component+const MotionPath = motion.path;++interface AgentAvatarProps {+ agent: AgentKey;+ clock: MotionValue<number>;+}++/** One agent. `clock` is the master playback head in seconds. */+export function AgentAvatar({ agent, clock }: AgentAvatarProps) {+ const shape = SHAPES[agent];+ const smileGeom = SMILE_GEOM[agent];+ const px = useMotionValue(0);+ const py = useMotionValue(0);+ const blink = useMotionValue(1);+ const smile = useMotionValue(0);+ // Exactly one eye treatment is ever on screen: the smile is 0 or 1, never in between.+ const pupilOpacity = useTransform(smile, (s) => 1 - s);++ // Pupils ease toward their target rather than snapping — a ~180ms settle at 60fps.+ useMotionValueEvent(clock, 'change', (t) => {+ const next = eyeState(agent, t);+ px.set(px.get() + (next.x - px.get()) * 0.22);+ py.set(py.get() + (next.y - py.get()) * 0.22);+ blink.set(next.blink);+ smile.set(next.smile);+ });++ return (+ <svg viewBox="0 0 512 512" className="h-full w-full overflow-visible" aria-hidden="true">+ <path d={shape.body} fill={AVATARS[agent].body} />+ {shape.eyes.map((d) => (+ <MotionPath+ key={d.slice(0, 24)}+ d={d}+ fill={PALETTE.eye}+ style={{ ...EYE_STYLE, x: px, y: py, scaleY: blink, opacity: pupilOpacity }}+ />+ ))}+ {smileGeom.eyes.map((eye) => (+ <MotionPath+ key={eye.cx}+ d={smileArc(eye)}+ fill="none"+ stroke={PALETTE.eye}+ strokeWidth={smileGeom.stroke}+ strokeLinecap="round"+ style={{ opacity: smile }}+ />+ ))}+ </svg>+ );+}++/**+ * The free-flying copies. Each takes over from its clipped in-slot agent at the moment that+ * agent's row opens in the chat (7.90s for the writer, 9.10s for the builder) — same pixels,+ * same frame — then arcs out of the logo and lands on its row tile, where the row's own+ * avatar takes over again so the agent rides the next push-up with its row. Keeping it one+ * continuous object is the whole point: nothing teleports.+ */+interface EjectedAgentsProps {+ clock: MotionValue<number>;+}++export function EjectedAgents({ clock }: EjectedAgentsProps) {+ return (+ <>+ {(['writer', 'builder'] as const).map((agent) => {+ const a = AVATARS[agent];+ const e = EJECT[agent];+ return (+ <div+ key={agent}+ className={`eject-${agent} pointer-events-none absolute z-30`}+ style={{+ left: e.fromLeft,+ top: e.fromTop,+ width: a.box,+ height: a.box,+ opacity: 0,+ transform: 'translate(0px, 0px) scale(1)',+ }}+ >+ <AgentAvatar agent={agent} clock={clock} />+ </div>+ );+ })}+ </>+ );+}diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/CapabilityRing.tsx b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/CapabilityRing.tsxnew file mode 100644index 000000000..ceba31d20--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/CapabilityRing.tsx@@ -0,0 +1,90 @@+import { Cable, Cpu, Goal, Hand, type LucideIcon, ShieldCheck } from 'lucide-react';+import { CHIPS, type ChipIcon, MARK, PALETTE } from './timeline';++/*+ * The five capability chips.+ *+ * Each chip keeps the radius Max hand-placed it at — the ring is deliberately irregular, and+ * a uniform radius flattens the composition. The orbit is therefore one rotation on the ring+ * container (which preserves every chip's own radius) rather than five independent arcs; each+ * chip then counter-rotates by the same angle so its label stays upright.+ *+ * Absorption translates the chip toward the ring centre *in the ring's rotating frame*, so+ * the straight pull is bent into a spiral by the orbit still running underneath it.+ */++const ICONS: Record<ChipIcon, LucideIcon> = { Cable, Cpu, Goal, Hand, ShieldCheck };++interface ChipVisualProps {+ label: string;+ icon: ChipIcon;+}++function ChipVisual({ label, icon }: ChipVisualProps) {+ const Icon = ICONS[icon];+ return (+ <div+ className="flex shrink-0 items-center gap-[8px] rounded-[16px] p-[16px] whitespace-nowrap"+ style={{+ backgroundColor: PALETTE.surface,+ color: PALETTE.ink, // the icon inherits this; lucide's `color` prop would write an+ // attribute, and a CSS variable does not resolve in one+ filter: `drop-shadow(0 1px 2px ${PALETTE.chipShadow})`,+ }}+ >+ <Icon size={20} strokeWidth={1.75} aria-hidden="true" />+ <span+ className="font-['Space_Grotesk'] font-medium"+ style={{+ fontSize: 16,+ lineHeight: '23px',+ letterSpacing: '-0.32px',+ color: PALETTE.ink,+ }}+ >+ {label}+ </span>+ </div>+ );+}++export function CapabilityRing() {+ return (+ <div+ className="chip-orbit pointer-events-none absolute z-0"+ style={{ left: MARK.cx, top: MARK.cy, width: 0, height: 0, transform: 'rotate(0deg)' }}+ >+ {CHIPS.map((chip) => {+ const rad = (chip.angle * Math.PI) / 180;+ return (+ <div+ key={chip.id}+ // zero-size flex box: centres the chip exactly on its polar point, whatever its width+ className="absolute flex items-center justify-center"+ style={{+ left: chip.r * Math.cos(rad),+ top: chip.r * Math.sin(rad),+ width: 0,+ height: 0,+ }}+ >+ <div+ className={`chip-${chip.id} shrink-0`}+ style={{+ opacity: 0,+ transform: `translate(0px, 0px) scale(0) rotate(${chip.jitter}deg)`,+ }}+ >+ <div+ className={`chip-counter-${chip.id} shrink-0`}+ style={{ transform: 'rotate(0deg)' }}+ >+ <ChipVisual label={chip.label} icon={chip.icon} />+ </div>+ </div>+ </div>+ );+ })}+ </div>+ );+}diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/ChatPanel.tsx b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/ChatPanel.tsxnew file mode 100644index 000000000..7c6f16561--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/ChatPanel.tsx@@ -0,0 +1,311 @@+import { type MotionValue } from 'motion/react';+import { type ReactNode } from 'react';+import { AgentAvatar } from './AgentAvatar';+import lassyaAvatar from './assets/lassya.png';+import {+ type AgentKey,+ AVATARS,+ CHANNELS,+ MESSAGE_AREA,+ PALETTE,+ PANEL,+ PANEL_GLOW,+ ROWS,+ STACK_Y,+ type MessageRow,+} from './timeline';++/*+ * The workspace the agents step into: channel sidebar + message stack.+ *+ * Every row sits at its final coordinate inside one stack container, and the push-up is a+ * single `y` on that container clipped by the message area — so bottom-anchoring is just+ * arithmetic (a row that hasn't arrived is below the clip) and there is no height, layout+ * or reflow change anywhere in the piece.+ *+ * Each agent's avatar tile holds a real inlined agent, hidden until the free-flying clone+ * finishes its arc onto exactly these pixels. From that swap the agent belongs to the stack+ * rather than floating over it.+ *+ * No typing indicators: the avatar arriving IS the arrival signal, and dots after it are a+ * slower second beat saying the same thing.+ */++const FONT = "font-['Lato']";++interface ChannelRowProps {+ name: string;+ index: number;+ active: boolean;+}++function ChannelRow({ name, index, active }: ChannelRowProps) {+ return (+ <div+ className={`channel-${index} relative rounded-[8px] px-[12px] py-[6px]`}+ style={{ opacity: 0, transform: 'translateY(8px)' }}+ >+ {active && (+ <span+ className="channel-active-bg absolute inset-0 rounded-[8px]"+ style={{ backgroundColor: PALETTE.channelActive, opacity: 0 }}+ />+ )}+ <span+ className={`${FONT} relative`}+ style={{+ fontSize: 14,+ lineHeight: '20px',+ fontWeight: active ? 700 : 500,+ color: PALETTE.chatInk,+ }}+ >+ {name}+ </span>+ </div>+ );+}++interface MentionProps {+ agent: AgentKey;+ children: ReactNode;+}++function Mention({ agent, children }: MentionProps) {+ return (+ <span+ className={`mention-${agent} rounded-[4px] px-[3px]`}+ style={{+ backgroundColor: agent === 'writer' ? 'rgba(161,201,210,0)' : 'rgba(255,137,94,0)',+ }}+ >+ {children}+ </span>+ );+}++interface TextProps {+ children: ReactNode;+}++function AuthorName({ children }: TextProps) {+ return (+ <div+ className={FONT}+ style={{ fontSize: 14, lineHeight: '20px', fontWeight: 700, color: PALETTE.chatInk }}+ >+ {children}+ </div>+ );+}++function BodyLine({ children }: TextProps) {+ return (+ <div className={FONT} style={{ fontSize: 15, lineHeight: '22px', color: PALETTE.chatBody }}>+ {children}+ </div>+ );+}++interface RowProps {+ row: MessageRow;+ children: ReactNode;+}++function Row({ row, children }: RowProps) {+ return (+ <div+ className="absolute flex items-start gap-[16px]"+ style={{ left: 0, top: row.top - MESSAGE_AREA.top, width: MESSAGE_AREA.w }}+ >+ {children}+ </div>+ );+}++/*+ * Lassya's headshot, cropped to the same 40px block the agents get.+ *+ * The asset is 120x124 of solid WHITE with the portrait sitting as a 90x90 square at+ * (19,17). Dropped straight into a 40px tile that padding is invisible against the panel,+ * so her avatar read ~30px next to the agents' 40 — the same tile, three different sizes.+ * Scaling the 90x90 region up to fill the tile puts all three on the bigger size.+ *+ * `max-w-none` is load-bearing: Tailwind's preflight caps images at 100% of their box, which+ * would shrink the oversized image back down and undo the crop.+ */+const LASSYA_CROP = { x: 19, y: 17, size: 90, w: 120, h: 124 };++function LassyaAvatar() {+ const k = 40 / LASSYA_CROP.size;+ return (+ <div className="h-[40px] w-[40px] shrink-0 overflow-hidden rounded-[8px]">+ <img+ src={lassyaAvatar}+ alt=""+ className="max-w-none"+ style={{+ width: LASSYA_CROP.w * k,+ height: LASSYA_CROP.h * k,+ marginLeft: -LASSYA_CROP.x * k,+ marginTop: -LASSYA_CROP.y * k,+ }}+ />+ </div>+ );+}++/*+ * The agent's permanent home: a 40px tile with the inlined agent inset at exactly the size+ * and position the flying clone lands at, so the handoff is pixel-identical.+ */+interface AgentClockProps {+ agent: AgentKey;+ clock: MotionValue<number>;+}++function RowAvatar({ agent, clock }: AgentClockProps) {+ const box = AVATARS[agent].box * AVATARS[agent].ejectScale;+ return (+ <div+ className={`tile-${agent} relative h-[40px] w-[40px] shrink-0 rounded-[8px]`}+ style={{ backgroundColor: PALETTE.tile, opacity: 0 }}+ >+ <div+ className={`rowavatar-${agent} absolute`}+ style={{ left: (40 - box) / 2, top: (40 - box) / 2, width: box, height: box, opacity: 0 }}+ >+ <AgentAvatar agent={agent} clock={clock} />+ </div>+ </div>+ );+}++interface ChatPanelProps {+ clock: MotionValue<number>;+}++export function ChatPanel({ clock }: ChatPanelProps) {+ const [lassya, writer, builder] = ROWS;+ const textWidth = MESSAGE_AREA.w - 56; // 40px avatar + 16px gap++ return (+ <div+ className="chat-panel pointer-events-none absolute z-20 flex rounded-[16px]"+ style={{+ left: PANEL.left,+ top: PANEL.top,+ width: PANEL.w,+ height: PANEL.h,+ padding: PANEL.pad,+ gap: PANEL.gap,+ backgroundColor: PALETTE.panel,+ opacity: 0,+ transform: `translateY(${PANEL.riseY}px)`,+ }}+ >+ {/* channels */}+ <div className="flex shrink-0 flex-col gap-[2px]" style={{ width: PANEL.sidebarW }}>+ {CHANNELS.map((name, i) => (+ <ChannelRow key={name} name={name} index={i} active={i === 0} />+ ))}+ </div>++ {/* messages */}+ <div+ className="relative shrink-0 rounded-[16px]"+ style={{ width: PANEL.messageW, backgroundColor: PALETTE.surface }}+ >+ {/* the clip the push-up reads against — a row below it simply hasn't arrived yet */}+ <div+ className="absolute overflow-hidden"+ style={{+ left: PANEL.messagePad,+ top: PANEL.messagePad,+ width: MESSAGE_AREA.w,+ height: MESSAGE_AREA.h,+ }}+ >+ <div+ className="msg-stack absolute inset-0"+ style={{ transform: `translateY(${STACK_Y.closed}px)` }}+ >+ <Row row={lassya}>+ <div+ className="msg-lassya flex gap-[16px]"+ style={{ opacity: 0, transform: 'translateY(14px)' }}+ >+ <LassyaAvatar />+ <div style={{ width: textWidth }}>+ <AuthorName>Lassya</AuthorName>+ <BodyLine>+ <Mention agent="writer">@writer</Mention>{' '}+ <Mention agent="builder">@builder</Mention> can you help+ </BodyLine>+ </div>+ </div>+ </Row>++ {[writer, builder].map((row) => {+ const agent = row.id;+ return (+ <Row key={agent} row={row}>+ <RowAvatar agent={agent} clock={clock} />+ <div style={{ width: textWidth }}>+ <div+ className={`msg-${agent}-0`}+ style={{ opacity: 0, transform: 'translateY(14px)' }}+ >+ <AuthorName>{row.author}</AuthorName>+ <BodyLine>{row.lines[0]}</BodyLine>+ </div>+ {row.lines[1] && (+ <div+ className={`msg-${agent}-1`}+ style={{ opacity: 0, transform: 'translateY(14px)' }}+ >+ <BodyLine>{row.lines[1]}</BodyLine>+ </div>+ )}+ </div>+ </Row>+ );+ })}+ </div>+ </div>+ </div>+ </div>+ );+}++/*+ * The surface glowing where the mark went in — the same power-up bloom the agents get, but+ * across the whole messaging UI and far more restrained.+ *+ * Two offset radial stops, one per agent colour, so the panel briefly takes on the colour of+ * the two things that just came out of it. Each stop fades to its OWN hue at zero alpha, not+ * to `transparent` — `transparent` is rgba(0,0,0,0) and would fringe the bloom grey.+ *+ * Rendered BEHIND the panel and inflated past its bounds, so what reads is a halo bleeding+ * out from the edges rather than a wash over the message text.+ */+export function PanelGlow() {+ const { bleed, blur } = PANEL_GLOW;+ return (+ <div+ className="panel-glow pointer-events-none absolute"+ style={{+ left: PANEL.left - bleed,+ top: PANEL.top - bleed,+ width: PANEL.w + bleed * 2,+ height: PANEL.h + bleed * 2,+ borderRadius: 16 + bleed,+ background: PANEL_GLOW.background,+ filter: `blur(${blur}px)`,+ zIndex: 15,+ opacity: 0,+ transform: 'scale(0.98)',+ }}+ />+ );+}diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/IntroSequence.tsx b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/IntroSequence.tsxnew file mode 100644index 000000000..a09907182--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/IntroSequence.tsx@@ -0,0 +1,67 @@+import { useAnimate, useMotionValue, useReducedMotion } from 'motion/react';+import { useEffect, useRef } from 'react';+import { EjectedAgents } from './AgentAvatar';+import { CapabilityRing } from './CapabilityRing';+import { ChatPanel, PanelGlow } from './ChatPanel';+import { SwitchMark } from './SwitchMark';+import { DURATION, buildSequence } from './timeline';++interface IntroSequenceProps {+ onComplete?: () => void;+}++/*+ * <IntroSequence onComplete={} /> — the whole 10.2s piece, self-contained so it can drop+ * into the onboarding wizard later as a pre-wizard splash.+ *+ * One `useAnimate()` scope, one `animate([...])` call. Every beat in timeline.ts carries an+ * absolute `at:` offset, so the sequence array reads as the beat sheet and the playback head+ * is single.+ *+ * Every animated element carries an inline style matching the first keyframe of its first+ * beat, and every segment uses explicit [from, to] arrays — nothing is read back off the+ * DOM, so the piece is identical on every play.+ */+export function IntroSequence({ onComplete }: IntroSequenceProps) {+ const [scope, animate] = useAnimate<HTMLDivElement>();+ const clock = useMotionValue(0);+ const onCompleteRef = useRef(onComplete);+ const reduced = useReducedMotion();++ // kept in a ref so changing the callback never restarts the sequence+ useEffect(() => {+ onCompleteRef.current = onComplete;+ });++ useEffect(() => {+ const controls = animate(buildSequence(clock));++ if (reduced) {+ // Reduced motion: same composition, no movement — jump the playback head to the end.+ controls.time = DURATION;+ controls.pause();+ clock.set(DURATION);+ onCompleteRef.current?.();+ return () => controls.stop();+ }++ let cancelled = false;+ void controls.then(() => {+ if (!cancelled) onCompleteRef.current?.();+ });+ return () => {+ cancelled = true;+ controls.stop();+ };+ }, [animate, clock, reduced]);++ return (+ <div ref={scope} className="absolute inset-0">+ <CapabilityRing />+ <SwitchMark clock={clock} />+ <PanelGlow />+ <ChatPanel clock={clock} />+ <EjectedAgents clock={clock} />+ </div>+ );+}diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/SwitchMark.tsx b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/SwitchMark.tsxnew file mode 100644index 000000000..cd2efc03d--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/SwitchMark.tsx@@ -0,0 +1,253 @@+import { type MotionValue } from 'motion/react';+import { AgentAvatar } from './AgentAvatar';+import { AVATARS, MARK, MARK_CLIP, PALETTE, ABSORB_ORDER, MARK_T, type AgentKey } from './timeline';++/*+ * The Switch mark, inlined as real SVG.+ *+ * The hollow-out is a real *thinning*, not an outline of the original: the black mass loses+ * thickness progressively until it is a 1px line drawing — outer chamfered square plus one+ * horizontal divider, no pips.+ *+ * That is driven by a single thickness `T`, via a clip-path rig:+ * - the outer ring is the outer path stroked at `2T` and clipped to itself, so exactly `T`+ * of it shows inward+ * - the divider is a line across the middle at width `T`+ * At T = 13.3958 (the logo's real ring thickness) the rig reconstructs the logo exactly; at+ * T = 1 it is the line drawing. No `vector-effect` — T is in user units, which is the point.+ *+ * One caveat: the real logo's inner bar corners are rounded at r≈7.3, but a constant-offset+ * stroke gives r≈1.2. That is only visible while the stroke is thick, so the exact filled+ * path carries the static opening and crossfades out over the first 120ms of the morph while+ * the rig thins underneath. Exact at both ends; the discrepancy is masked in between.+ *+ * The Figma export's #393939 backing rect and the two "Section 2" artboard paths are stripped.+ */++const PIPS = [+ 'M29.8503 79.9215C32.8769 79.9215 35.3304 82.375 35.3304 85.4016V93.9261C35.3304 96.9527 32.8769 99.4062 29.8503 99.4062C26.8237 99.4062 24.3702 96.9527 24.3702 93.9261V85.4016C24.3702 82.375 26.8237 79.9215 29.8503 79.9215Z',+ 'M51.7706 79.9215C54.7972 79.9215 57.2507 82.375 57.2507 85.4016V93.9261C57.2507 96.9527 54.7972 99.4062 51.7706 99.4062C48.7441 99.4062 46.2905 96.9527 46.2905 93.9261V85.4016C46.2905 82.375 48.7441 79.9215 51.7706 79.9215Z',+ 'M72.2365 24.5783C75.2631 24.5783 77.7166 27.0318 77.7166 30.0584V38.583C77.7166 41.6096 75.2631 44.0631 72.2365 44.0631C69.2099 44.0631 66.7564 41.6096 66.7564 38.583V30.0584C66.7564 27.0318 69.2099 24.5783 72.2365 24.5783Z',+ 'M94.1568 24.5783C97.1834 24.5783 99.6369 27.0318 99.6369 30.0584V38.583C99.6369 41.6096 97.1834 44.0631 94.1568 44.0631C91.1303 44.0631 88.6768 41.6096 88.6768 38.583V30.0584C88.6768 27.0318 91.1303 24.5783 94.1568 24.5783Z',+];++// Outer chamfered square only — the first subpath of the full mark, without the two bar holes.+const OUTER =+ 'M109.386 0C117.457 0 124 6.54271 124 14.6136V90.3917C124 94.2674 122.46 97.9845 119.72 ' ++ '100.725L100.725 119.72C97.9845 122.46 94.2674 124 90.3917 124H14.6136C6.54272 124 0 117.457 ' ++ '0 109.386V33.6083C0 29.7326 1.5396 26.0155 4.28013 23.2749L23.2749 4.28013C26.0155 1.5396 ' ++ '29.7326 0 33.6083 0H109.386Z';++// The exact filled logo: outer square minus the two bar holes (evenodd).+const BODY =+ OUTER ++ 'M19.4847 68.6985C16.1219 68.6985 13.3958 71.4246 13.3958 ' ++ '74.7875V103.297C13.3958 107.333 16.6671 110.604 20.7025 110.604H84.8426C88.7183 110.604 ' ++ '92.4355 109.065 95.176 106.324L106.324 95.176C109.065 92.4355 110.604 88.7183 110.604 ' ++ '84.8426V74.7875C110.604 71.4246 107.878 68.6985 104.515 68.6985H19.4847ZM39.1574 ' ++ '13.3958C35.2817 13.3958 31.5645 14.9354 28.824 17.6759L17.6759 28.824C14.9354 31.5645 ' ++ '13.3958 35.2817 13.3958 39.1574V49.2137C13.3958 52.5766 16.1219 55.3027 19.4847 ' ++ '55.3027H104.515C107.878 55.3027 110.604 52.5766 110.604 49.2137V20.7025C110.604 16.6671 ' ++ '107.333 13.3958 103.297 13.3958H39.1574Z';++/*+ * `strokeWidth` is the one property the sequence drives in JS rather than through WAAPI+ * (only opacity / transform / filter / clipPath get accelerated). motion/react writes it to+ * the element's `stroke-width` ATTRIBUTE, and an inline style outranks a presentation+ * attribute, so the starting thickness must be an attribute too: written as inline style,+ * it held the logo solid while the animation thinned an attribute nobody could see. If+ * React owned it (as a prop), a re-render — e.g. a parent's state change on completion —+ * would stomp the animated value back to full thickness.+ *+ * So the initial thickness is set once imperatively and the animation is its sole owner.+ * These callbacks are module-level on purpose: a ref callback with a changing identity is+ * re-invoked (null, then the node) on every render, which would reintroduce the same stomp.+ */+const initRingStroke = (el: SVGPathElement | null): void => {+ if (el) el.setAttribute('stroke-width', String(MARK_T.from * 2));+};+const initDividerStroke = (el: SVGLineElement | null): void => {+ if (el) el.setAttribute('stroke-width', String(MARK_T.from));+};++const CLIP_OUTER = 'switch-mark-outer';+const CLIP_UPPER = 'switch-mark-slot-upper';+const CLIP_LOWER = 'switch-mark-slot-lower';++/*+ * Power-up bloom. One per absorption hit, per agent, in that agent's own colour — rendered in+ * the mark body rather than inside the slot clip so it isn't cut off by the slot, but BEFORE+ * the slots so it blooms behind the agents and lights them from behind rather than washing+ * over their faces.+ *+ * Its opacity track starts at 0 deliberately: in a motion sequence a track holds its+ * FIRST KEYFRAME from t=0, not the element's inline style, so a non-zero opening keyframe+ * would park a visible blob on screen before the piece has even begun.+ */+interface GlowsProps {+ agent: AgentKey;+}++function Glows({ agent }: GlowsProps) {+ const a = AVATARS[agent];+ const size = a.box * 2;+ return ABSORB_ORDER.map((_, k) => (+ <div+ key={k}+ className={`glow-${agent}-${k} pointer-events-none absolute rounded-full`}+ style={{+ left: a.cx - size / 2,+ top: a.cy - size / 2,+ width: size,+ height: size,+ background: a.glow,+ opacity: 0,+ transform: 'scale(0.8)',+ }}+ />+ ));+}++/*+ * The crop shapes: the interior of the finished LINE DRAWING, not of the original thick+ * mark. An SVG clipPath UNIONs its children, so the silhouette and the half-plane are+ * intersected by clipping one clipPath with the other.+ *+ * `clipPathUnits="userSpaceOnUse"` makes the coordinates the referencing element's own+ * pixels, and the mark renders 1:1, so mark units map straight through.+ */+function MarkClipDefs() {+ return (+ <svg className="absolute h-0 w-0" aria-hidden="true">+ <defs>+ <clipPath id={CLIP_OUTER} clipPathUnits="userSpaceOnUse">+ <path d={OUTER} />+ </clipPath>+ <clipPath id={CLIP_UPPER} clipPathUnits="userSpaceOnUse" clipPath={`url(#${CLIP_OUTER})`}>+ <rect x="0" y="0" width={MARK.size} height={MARK_CLIP.upper} />+ </clipPath>+ <clipPath id={CLIP_LOWER} clipPathUnits="userSpaceOnUse" clipPath={`url(#${CLIP_OUTER})`}>+ <rect x="0" y={MARK_CLIP.lower} width={MARK.size} height={MARK.size - MARK_CLIP.lower} />+ </clipPath>+ </defs>+ </svg>+ );+}++/* One agent, cut by the line drawing rather than by a rectangle. A rect wrapper cannot+ * express this crop — it has to follow the chamfered corners of the silhouette. */+interface SlotProps {+ agent: AgentKey;+ clock: MotionValue<number>;+}++function Slot({ agent, clock }: SlotProps) {+ const a = AVATARS[agent];+ const clip = agent === 'writer' ? CLIP_UPPER : CLIP_LOWER;+ return (+ <div className="absolute inset-0" style={{ clipPath: `url(#${clip})` }}>+ <div+ className={`agent-${agent} absolute`}+ style={{+ left: a.left,+ top: a.top,+ width: a.box,+ height: a.box,+ opacity: 0,+ transform: 'translateY(18px) scale(0.4)',+ }}+ >+ <AgentAvatar agent={agent} clock={clock} />+ </div>+ </div>+ );+}++interface SwitchMarkProps {+ clock: MotionValue<number>;+}++export function SwitchMark({ clock }: SwitchMarkProps) {+ return (+ <div+ className="mark-layer pointer-events-none absolute z-10"+ style={{+ left: MARK.left,+ top: MARK.top,+ width: MARK.size,+ height: MARK.size,+ transform: 'translateY(0px)',+ }}+ >+ <div className="mark-body absolute inset-0" style={{ opacity: 0, transform: 'scale(0.82)' }}>+ <MarkClipDefs />++ {/*+ The agents render UNDER the mark's artwork, so the line art always draws over their+ cut edges: a sub-pixel crop error becomes invisible instead of becoming a gap, and+ the ring correctly covers them during the window where they pop while the morph is+ still finishing.+ */}+ <Glows agent="writer" />+ <Glows agent="builder" />++ <Slot agent="writer" clock={clock} />+ <Slot agent="builder" clock={clock} />++ {/*+ fill and stroke live on the <svg> and the children inherit them, because a CSS+ variable does NOT resolve in an SVG presentation attribute — only in a CSS+ declaration. The one child that must not inherit the fill says so itself+ (`fill="none"` on the ring).+ */}+ <svg+ viewBox="0 0 124 124"+ className="absolute inset-0 h-full w-full overflow-visible"+ aria-hidden="true"+ style={{ fill: PALETTE.ink, stroke: PALETTE.ink }}+ >+ {/* the thinning rig: ring + divider, driven by one thickness */}+ {/*+ Opaque from the start, and UNDERNEATH `.mark-solid` — so the hand-over fades only+ the top layer and the composite stays 100% black, instead of dipping to ~75%+ mid-crossfade. Nothing animates this opacity: if you set it to 0 here, the rig is+ never turned on and the whole line-art logo is invisible for the entire piece.+ */}+ <g className="mark-rig" clipPath={`url(#${CLIP_OUTER})`} style={{ opacity: 1 }}>+ <path+ ref={initRingStroke}+ className="mark-ring"+ d={OUTER}+ fill="none"+ strokeLinejoin="round"+ />+ <line+ ref={initDividerStroke}+ className="mark-divider"+ x1="0"+ y1={MARK_T.dividerY}+ x2="124"+ y2={MARK_T.dividerY}+ />+ </g>++ {/*+ the exact filled logo, on top, for the static opening. Its starting opacity is an+ attribute, not inline style: motion/react fades an SVG element's opacity+ ATTRIBUTE, which an inline style would outrank, holding the solid logo on top.+ */}+ <path className="mark-solid" d={BODY} fillRule="evenodd" clipRule="evenodd" opacity={1} />++ {PIPS.map((d) => (+ <path+ key={d.slice(0, 18)}+ className="mark-pip"+ d={d}+ style={{ opacity: 1, transform: 'scale(1)' }}+ />+ ))}+ </svg>+ </div>+ </div>+ );+}diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/assets/aurora.svg b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/assets/aurora.svgnew file mode 100644index 000000000..71ce20dc6--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/assets/aurora.svg@@ -0,0 +1,17 @@+<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="2488" height="1525" viewBox="0 0 2488 1525" fill="none" xmlns="http://www.w3.org/2000/svg">+<g id="Vector 5" opacity="0.6" filter="url(#filter0_f_0_52)">+<path d="M300 305.808L2188 300L1241.03 1225L300 305.808Z" fill="url(#paint0_linear_0_52)"/>+</g>+<defs>+<filter id="filter0_f_0_52" x="0" y="0" width="2488" height="1525" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">+<feFlood flood-opacity="0" result="BackgroundImageFix"/>+<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>+<feGaussianBlur stdDeviation="150" result="effect1_foregroundBlur_0_52"/>+</filter>+<linearGradient id="paint0_linear_0_52" x1="1244" y1="302.906" x2="1128.64" y2="965.241" gradientUnits="userSpaceOnUse">+<stop offset="0.299301" stop-color="#FF9673" stop-opacity="0.7"/>+<stop offset="0.343315" stop-color="#F8C388" stop-opacity="0.7"/>+<stop offset="0.947115" stop-color="#A1C9D2" stop-opacity="0.8"/>+</linearGradient>+</defs>+</svg>diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/assets/lassya.png b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/assets/lassya.pngnew file mode 100644index 000000000..c3a3991c5Binary files /dev/null and b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/assets/lassya.png differdiff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/OFL-Lato.txt b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/OFL-Lato.txtnew file mode 100644index 000000000..98383e3d8--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/OFL-Lato.txt@@ -0,0 +1,93 @@+Copyright (c) 2010-2014 by tyPoland Lukasz Dziedzic ([email protected]) with Reserved Font Name "Lato"++This Font Software is licensed under the SIL Open Font License, Version 1.1.+This license is copied below, and is also available with a FAQ at:+http://scripts.sil.org/OFL+++-----------------------------------------------------------+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007+-----------------------------------------------------------++PREAMBLE+The goals of the Open Font License (OFL) are to stimulate worldwide+development of collaborative font projects, to support the font creation+efforts of academic and linguistic communities, and to provide a free and+open framework in which fonts may be shared and improved in partnership+with others.++The OFL allows the licensed fonts to be used, studied, modified and+redistributed freely as long as they are not sold by themselves. The+fonts, including any derivative works, can be bundled, embedded,+redistributed and/or sold with any software provided that any reserved+names are not used by derivative works. The fonts and derivatives,+however, cannot be released under any other type of license. The+requirement for fonts to remain under this license does not apply+to any document created using the fonts or their derivatives.++DEFINITIONS+"Font Software" refers to the set of files released by the Copyright+Holder(s) under this license and clearly marked as such. This may+include source files, build scripts and documentation.++"Reserved Font Name" refers to any names specified as such after the+copyright statement(s).++"Original Version" refers to the collection of Font Software components as+distributed by the Copyright Holder(s).++"Modified Version" refers to any derivative made by adding to, deleting,+or substituting -- in part or in whole -- any of the components of the+Original Version, by changing formats or by porting the Font Software to a+new environment.++"Author" refers to any designer, engineer, programmer, technical+writer or other person who contributed to the Font Software.++PERMISSION & CONDITIONS+Permission is hereby granted, free of charge, to any person obtaining+a copy of the Font Software, to use, study, copy, merge, embed, modify,+redistribute, and sell modified and unmodified copies of the Font+Software, subject to the following conditions:++1) Neither the Font Software nor any of its individual components,+in Original or Modified Versions, may be sold by itself.++2) Original or Modified Versions of the Font Software may be bundled,+redistributed and/or sold with any software, provided that each copy+contains the above copyright notice and this license. These can be+included either as stand-alone text files, human-readable headers or+in the appropriate machine-readable metadata fields within text or+binary files as long as those fields can be easily viewed by the user.++3) No Modified Version of the Font Software may use the Reserved Font+Name(s) unless explicit written permission is granted by the corresponding+Copyright Holder. This restriction only applies to the primary font name as+presented to the users.++4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font+Software shall not be used to promote, endorse or advertise any+Modified Version, except to acknowledge the contribution(s) of the+Copyright Holder(s) and the Author(s) or with their explicit written+permission.++5) The Font Software, modified or unmodified, in part or in whole,+must be distributed entirely under this license, and must not be+distributed under any other license. The requirement for fonts to+remain under this license does not apply to any document created+using the Font Software.++TERMINATION+This license becomes null and void if any of the above conditions are+not met.++DISCLAIMER+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM+OTHER DEALINGS IN THE FONT SOFTWARE.diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/OFL-SpaceGrotesk.txt b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/OFL-SpaceGrotesk.txtnew file mode 100644index 000000000..cb512b9af--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/OFL-SpaceGrotesk.txt@@ -0,0 +1,93 @@+Copyright 2020 The Space Grotesk Project Authors (https://github.com/floriankarsten/space-grotesk)++This Font Software is licensed under the SIL Open Font License, Version 1.1.+This license is copied below, and is also available with a FAQ at:+http://scripts.sil.org/OFL+++-----------------------------------------------------------+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007+-----------------------------------------------------------++PREAMBLE+The goals of the Open Font License (OFL) are to stimulate worldwide+development of collaborative font projects, to support the font creation+efforts of academic and linguistic communities, and to provide a free and+open framework in which fonts may be shared and improved in partnership+with others.++The OFL allows the licensed fonts to be used, studied, modified and+redistributed freely as long as they are not sold by themselves. The+fonts, including any derivative works, can be bundled, embedded,+redistributed and/or sold with any software provided that any reserved+names are not used by derivative works. The fonts and derivatives,+however, cannot be released under any other type of license. The+requirement for fonts to remain under this license does not apply+to any document created using the fonts or their derivatives.++DEFINITIONS+"Font Software" refers to the set of files released by the Copyright+Holder(s) under this license and clearly marked as such. This may+include source files, build scripts and documentation.++"Reserved Font Name" refers to any names specified as such after the+copyright statement(s).++"Original Version" refers to the collection of Font Software components as+distributed by the Copyright Holder(s).++"Modified Version" refers to any derivative made by adding to, deleting,+or substituting -- in part or in whole -- any of the components of the+Original Version, by changing formats or by porting the Font Software to a+new environment.++"Author" refers to any designer, engineer, programmer, technical+writer or other person who contributed to the Font Software.++PERMISSION & CONDITIONS+Permission is hereby granted, free of charge, to any person obtaining+a copy of the Font Software, to use, study, copy, merge, embed, modify,+redistribute, and sell modified and unmodified copies of the Font+Software, subject to the following conditions:++1) Neither the Font Software nor any of its individual components,+in Original or Modified Versions, may be sold by itself.++2) Original or Modified Versions of the Font Software may be bundled,+redistributed and/or sold with any software, provided that each copy+contains the above copyright notice and this license. These can be+included either as stand-alone text files, human-readable headers or+in the appropriate machine-readable metadata fields within text or+binary files as long as those fields can be easily viewed by the user.++3) No Modified Version of the Font Software may use the Reserved Font+Name(s) unless explicit written permission is granted by the corresponding+Copyright Holder. This restriction only applies to the primary font name as+presented to the users.++4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font+Software shall not be used to promote, endorse or advertise any+Modified Version, except to acknowledge the contribution(s) of the+Copyright Holder(s) and the Author(s) or with their explicit written+permission.++5) The Font Software, modified or unmodified, in part or in whole,+must be distributed entirely under this license, and must not be+distributed under any other license. The requirement for fonts to+remain under this license does not apply to any document created+using the Font Software.++TERMINATION+This license becomes null and void if any of the above conditions are+not met.++DISCLAIMER+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM+OTHER DEALINGS IN THE FONT SOFTWARE.diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/intro-fonts.css b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/intro-fonts.cssnew file mode 100644index 000000000..80137c9ca--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/intro-fonts.css@@ -0,0 +1,28 @@+/*+ * The intro's two typefaces, bundled so its first screen needs no network.+ * Both under the SIL Open Font License 1.1 (OFL-*.txt beside them); Latin+ * subsets, as Google Fonts serves them.+ */+@font-face {+ font-family: 'Space Grotesk';+ font-style: normal;+ font-weight: 400 700;+ font-display: block;+ src: url('./space-grotesk.woff2') format('woff2');+}++@font-face {+ font-family: 'Lato';+ font-style: normal;+ font-weight: 400;+ font-display: block;+ src: url('./lato-400.woff2') format('woff2');+}++@font-face {+ font-family: 'Lato';+ font-style: normal;+ font-weight: 700;+ font-display: block;+ src: url('./lato-700.woff2') format('woff2');+}diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/lato-400.woff2 b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/lato-400.woff2new file mode 100644index 000000000..56e968d1fBinary files /dev/null and b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/lato-400.woff2 differdiff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/lato-700.woff2 b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/lato-700.woff2new file mode 100644index 000000000..95c63e080Binary files /dev/null and b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/lato-700.woff2 differdiff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/space-grotesk.woff2 b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/space-grotesk.woff2new file mode 100644index 000000000..7b0e76a5cBinary files /dev/null and b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/fonts/space-grotesk.woff2 differdiff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/intro-scale.test.ts b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/intro-scale.test.tsnew file mode 100644index 000000000..4d54c95de--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/intro-scale.test.ts@@ -0,0 +1,15 @@+import { describe, expect, it } from 'vitest';+import { introScale } from './intro-scale';++describe('introScale', () => {+ it('plays at full size wherever the stage fits, never larger', () => {+ expect(introScale({ width: 1440, height: 900 })).toBe(1);+ expect(introScale({ width: 2560, height: 1440 })).toBe(1);+ });++ it('shrinks to fit a smaller window, keeping its shape', () => {+ expect(introScale({ width: 720, height: 900 })).toBe(0.5);+ expect(introScale({ width: 1440, height: 450 })).toBe(0.5);+ expect(introScale({ width: 700, height: 500 })).toBeCloseTo(0.486, 3);+ });+});diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/intro-scale.ts b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/intro-scale.tsnew file mode 100644index 000000000..f2b6fa13f--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/intro-scale.ts@@ -0,0 +1,10 @@+import { STAGE } from './timeline';++/**+ * The scale the intro's stage plays at: its own size wherever it fits, and+ * smaller only in a window smaller than it. It never reflows: the motion is+ * choreographed against exact geometry.+ */+export function introScale(available: { width: number; height: number }): number {+ return Math.min(1, available.width / STAGE.w, available.height / STAGE.h);+}diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/timeline.ts b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/timeline.tsnew file mode 100644index 000000000..447f05579--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/intro/timeline.ts@@ -0,0 +1,1160 @@+/*+ * Switch console onboarding animation — the beat sheet.+ *+ * Every timing, easing, spring constant, stagger and piece of geometry lives in this file.+ * Retiming the piece means editing numbers here and nowhere else.+ *+ * Spec sources:+ * ../SwitchOnboarding/session-outputs/intro-animation-plan.md (motion)+ * ./session-outputs/build-brief.md (geometry)+ *+ * Colour note: the hex values below are Switch / SandboxAQ brand values supplied by the+ * brief. They are NOT in this repo's design systems (Core DS / Hoot) — this is a+ * standalone branded splash, not a product screen, so the raw hex is intentional.+ * Same precedent as src/pages/SwitchOnboarding/SwitchOnboarding.jsx.+ */++import { type AnimationSequence, type MotionValue } from 'motion/react';++/* --------------------------------------------------------------------------- types */++export type AgentKey = 'writer' | 'builder';+export type MessageId = 'lassya' | AgentKey;+export type ThemeName = 'light' | 'dark';+export type ChipIcon = 'Cable' | 'Cpu' | 'Goal' | 'Hand' | 'ShieldCheck';++/** Cubic-bezier control points, [x1, y1, x2, y2]. */+export type CubicBezier = [number, number, number, number];++export interface Chip {+ id: string;+ label: string;+ icon: ChipIcon;+ r: number;+ angle: number;+ jitter: number;+}++export interface Message<Id extends MessageId = MessageId> {+ id: Id;+ author: string;+ lines: string[];+ h: number;+}++export interface MessageRow<Id extends MessageId = MessageId> extends Message<Id> {+ top: number;+ tileCx: number;+ tileCy: number;+}++export interface EjectTarget {+ at: number;+ flight: number;+ fromLeft: number;+ fromTop: number;+ dx: number;+ dy: number;+}++export interface AgentBeat {+ open: number;+ say: number;+ line2?: number;+}++export interface Gaze {+ x: number;+ y: number;+}++export interface EyeState extends Gaze {+ blink: number;+ smile: number;+}++interface Saccade extends Gaze {+ at: number;+}++/* -------------------------------------------------------------------------- colour */++/*+ * Every themeable colour is a CSS custom property, resolved from whichever theme the stage+ * has applied (see THEMES below). Variables rather than a React context for two reasons:+ * the palette is read at module scope across five files, and a theme swap then costs one+ * style write on one element instead of re-rendering a running animation.+ *+ * Three values are deliberately NOT themed. The agents keep their brand colours in both+ * themes — they are the subject of the piece, not chrome — and their eyes stay near-black+ * because they sit on those same pastel bodies either way. All three are also used as SVG+ * presentation ATTRIBUTES, which do not resolve var().+ *+ * The role names are the point: `surface` is "one level above the window", not "white".+ * That separation is what makes a dark theme expressible at all — the old palette used one+ * `white` for the window's top stop, the chip fill AND the message area, three jobs that+ * stay together in light and have to come apart in dark.+ */+export const PALETTE = {+ ink: 'var(--sw-ink)', // the mark's line art, chip labels and chip icons+ border: 'var(--sw-border)', // window border+ desktop: 'var(--sw-desktop)', // the dimmed desktop behind the window+ windowTop: 'var(--sw-window-top)', // window gradient, top stop+ windowBottom: 'var(--sw-window-bottom)', // window gradient, bottom stop+ surface: 'var(--sw-surface)', // chips, message area, controls — one level above the window+ panel: 'var(--sw-panel)', // the shell around the message area+ tile: 'var(--sw-tile)', // avatar tile inside a message row+ channelActive: 'var(--sw-channel-active)',+ chatInk: 'var(--sw-chat-ink)', // chat names / channel labels+ chatBody: 'var(--sw-chat-body)', // chat message body+ chipShadow: 'var(--sw-chip-shadow)',++ writer: '#A1C9D2', // brand — identical in both themes+ builder: '#FF895E',+ eye: '#0F172A',+};++/*+ * The two themes.+ *+ * Light is the original piece, unchanged, with its three `white` jobs split out by role.+ *+ * Dark is built on Fortress Black #1B1817 as the window, and the light theme's own+ * relationships are preserved rather than inverted blindly:+ *+ * - The window is LIGHTER than the desktop behind it in light (#fdfdfc on #e9e8e4), so it+ * is lighter than the desktop in dark too (#1B1817 on #0e0c0c) and still reads as a+ * window sitting on something rather than a hole cut in it.+ * - The window gradient warms as it falls in light (Clarity White -> Guardian Sand). Dark+ * warms as it falls as well, #1B1817 -> #241e1c, which also gives the aurora something+ * to bloom into at the bottom of the frame.+ * - Light's panel shell is a dark veil over the window; dark's is a light one, same 6%.+ * - Chat body text drops the same amount of contrast below the names in both.+ *+ * The aurora and the window chrome are assets, not colours, so they are handled with a+ * blend mode and a filter: the aurora's brand stops are pale, so on dark it SCREENS onto+ * the window as emitted light instead of sitting on it as a milky wash, and the wordmark+ * and close glyph — both solid black in the files — invert. The traffic lights are left+ * alone; they are the same three colours on any Mac, on any desktop.+ */+export const THEMES: Record<ThemeName, Record<string, string>> = {+ light: {+ '--sw-ink': '#1B1817', // Fortress Black+ '--sw-border': '#c5c9cf',+ '--sw-desktop': '#e9e8e4',+ '--sw-window-top': '#fdfdfc', // Clarity White+ '--sw-window-bottom': '#f4eee6', // Guardian Sand+ '--sw-surface': '#fdfdfc',+ '--sw-panel': 'rgba(26,26,26,0.06)',+ '--sw-tile': '#ececec',+ '--sw-channel-active': 'rgba(255,255,255,0.5)',+ '--sw-chat-ink': '#1f2328',+ '--sw-chat-body': '#4b5563',+ '--sw-chip-shadow': 'rgba(0,0,0,0.06)',+ '--sw-aurora-blend': 'normal',+ '--sw-aurora-opacity': '1',+ '--sw-chrome-filter': 'none',+ },+ dark: {+ '--sw-ink': '#fdfdfc', // Clarity White — the line art, inverted+ '--sw-border': '#38322f',+ '--sw-desktop': '#0e0c0c',+ '--sw-window-top': '#1B1817', // Fortress Black+ '--sw-window-bottom': '#241e1c',+ '--sw-surface': '#2e2725',+ '--sw-panel': 'rgba(253,253,252,0.06)',+ '--sw-tile': '#3a3230',+ '--sw-channel-active': 'rgba(253,253,252,0.08)',+ // Both brighter than a straight tonal inversion of the light theme would give: against+ // a near-black panel that reads as dim rather than as restraint. The body still sits a+ // step under the names, the same relationship light has.+ '--sw-chat-ink': '#fdfdfc', // names, channel labels+ '--sw-chat-body': '#ddd5ce', // warm off-white, ~10:1 on the message surface+ '--sw-chip-shadow': 'rgba(0,0,0,0.45)', // a shadow has to work harder on a dark surface+ '--sw-aurora-blend': 'screen',+ '--sw-aurora-opacity': '0.55',+ '--sw-chrome-filter': 'invert(1)',+ },+};++export const THEME_NAMES: ThemeName[] = ['light', 'dark'];++/* --------------------------------------------------------------------------- stage */++export const STAGE = { w: 1440, h: 900 };++/* ---------------------------------------------------------------------------- mark */++// 124x124 mark, centred at stage (729, 450) — 9px right of stage centre, matching aurora.+export const MARK = { size: 124, cx: 729, cy: 450, left: 667, top: 388 };++/*+ * The original THICK logo's bar interiors. The agents' rest positions still hang off these+ * (that is just where they sit inside the pod), but nothing is CROPPED against them any+ * more — the crop is the finished line drawing's interior, see MARK_CLIP.+ */+const BAR_TOP = 55.3027; // bottom edge of the upper bar+const BAR_BOTTOM = 68.6985; // top edge of the lower bar+const BAR_LOWER_BOTTOM = 110.604; // bottom edge of the lower bar++// Toss travel, from the Figma frames: rest centre y 450 -> apex 197 -> landed 349.+/*+ * The toss. `landed` carries the mark fully UNDER the chat panel — it disappears by+ * occlusion, never by fading. The only opaque thing on the stage is the white message panel+ * (x 599..1035, y 342..558); the outer panel is rgba(26,26,26,0.06) and hides nothing.+ *+ * At rest the mark is still stretched to scaleY 1.14 from the fall, so the test is against+ * the stretched box: MARK.cy + landed ± 62 * 1.14 must sit inside 342..558. That caps+ * `landed` at +37; +30 clears the bottom edge by 7.3 units.+ */+export const TOSS = { apex: -253, landed: 30 };++/* -------------------------------------------------------------------------- agents */++/*+ * Each avatar is a 512x512 viewBox whose visible shape is centred in the box. We size the+ * box so the shape reads SHAPE_W wide, then place the shape centre inside the slot.+ *+ * Shape centre x matches the mark's own indicator pips — upper-right for the writer,+ * lower-left for the builder — so the agents are literally born where the pips sit.+ *+ * Rest y = slotBottom - 0.45 * shapeHeight (peeking out, bottom edge cut by the slot).+ */+/*+ * Avatar size and rest position. Judge these against the RUNNING BUILD, not against a mock.+ *+ * SHAPE_W the agent's visible width, in mark units+ * REST_CLIP where the shape's centre sits above its bar's bottom edge, as a fraction of+ * its own height+ *+ * These are deliberately separate from the crop below: the crop is the interior of the+ * finished line drawing and is fixed by the logo, while these two decide how much of that+ * interior the agent actually fills.+ */+const SHAPE_W = 64;+const REST_CLIP = 0.36;++function avatarShape(nativeW: number, nativeH: number, cx: number, barBottom: number) {+ const scale = SHAPE_W / nativeW;+ const box = 512 * scale;+ const h = nativeH * scale;+ const cy = barBottom - REST_CLIP * h;+ return {+ scale,+ box,+ shapeW: SHAPE_W,+ shapeH: h,+ cx,+ cy,+ left: cx - box / 2,+ top: cy - box / 2,+ ejectScale: 26 / SHAPE_W, // lands as a 26px glyph inside the 40px chat tile+ };+}++export const AVATARS = {+ // writer: pill, native 391x253 inside the 512 box+ writer: {+ ...avatarShape(391, 253, 78, BAR_TOP),+ body: PALETTE.writer,+ // power-up bloom, in the agent's own colour. The far stop is the same hue at zero alpha,+ // not `transparent` — `transparent` is rgba(0,0,0,0) and fringes the bloom grey.+ glow: 'radial-gradient(circle, rgba(161,201,210,1) 0%, rgba(161,201,210,0) 70%)',+ },+ // builder: diamond, native 379x379 inside the 512 box+ builder: {+ ...avatarShape(379, 379, 46, BAR_LOWER_BOTTOM),+ body: PALETTE.builder,+ glow: 'radial-gradient(circle, rgba(255,137,94,1) 0%, rgba(255,137,94,0) 70%)',+ },+};++/*+ * The hollow-out thickness. T = 13.3958 is the logo's real ring thickness, so ring (stroked+ * at 2T, clipped to the outer path) + divider (width T, centred on the real gap band)+ * reconstructs the mark exactly; T = 1 is the finished line drawing.+ */+export const MARK_T = {+ from: 13.3958,+ to: 1,+ dividerY: (BAR_TOP + BAR_BOTTOM) / 2,+ at: 0.95,+ duration: 0.4,+ // front-loaded: most of the thinning happens early, then it settles into the line+ ease: [0.33, 1, 0.68, 1] satisfies CubicBezier,+};++/*+ * Where the agents are cropped. NOT the original thick logo's bar rects — those sit a full+ * ring thickness inside the finished artwork, which left a 6.2-unit dead gap above the+ * divider and 13.4 on every outer edge, so the agents floated inside the pod instead of+ * touching it.+ *+ * The crop is the interior of the LINE DRAWING: the outer silhouette, split by the two edges+ * of the 1px divider. Derived from the divider position and the final line weight so that if+ * the line weight ever changes the crop follows it.+ *+ * It is deliberately static — the agents arrive at the tail of the morph, and the slots now+ * render UNDER the mark's artwork, so the thick ring correctly covers them while it is still+ * thick, and the 1px lines draw over their cut edges afterwards. A sub-pixel crop error+ * becomes invisible rather than becoming a gap.+ */+export const MARK_CLIP = {+ upper: MARK_T.dividerY - MARK_T.to / 2,+ lower: MARK_T.dividerY + MARK_T.to / 2,+};++// Weightless float — contents of a falling container drift to the ceiling.+export const FLOAT_Y = -7;++/* --------------------------------------------------------------------------- chips */++/*+ * Hand-placed centres from Figma frame 5, expressed polar about the mark centre.+ * Each chip KEEPS ITS OWN RADIUS — a uniform ring flattens the composition. The orbit is a+ * single rotation applied to the whole ring, so the irregular shape is preserved.+ *+ * Angles are screen-space (y down): pos = centre + r * (cos t, sin t).+ */+export const CHIPS: Chip[] = [+ { id: 'models', label: 'Models', icon: 'Cpu', r: 190, angle: 222.2, jitter: 6 },+ { id: 'guardrails', label: 'Guardrails', icon: 'ShieldCheck', r: 196, angle: 166.0, jitter: -5 },+ { id: 'instructions', label: 'Instructions', icon: 'Goal', r: 195, angle: 118.6, jitter: 4 },+ { id: 'permissions', label: 'Permissions', icon: 'Hand', r: 238, angle: 42.4, jitter: -6 },+ { id: 'connections', label: 'Connections', icon: 'Cable', r: 208, angle: -25.2, jitter: 5 },+];++// Two DIFFERENT fixed shuffles. Never Math.random() — the demo must play identically every run.+export const POP_ORDER = [1, 4, 2, 0, 3]; // Guardrails, Connections, Instructions, Models, Permissions+export const ABSORB_ORDER = [2, 3, 0, 1, 4]; // Instructions, Permissions, Models, Guardrails, Connections++// The ring is already turning before the first chip appears, so each chip pops into a+// frame that is already in motion rather than sitting still and then starting.+export const ORBIT = { start: 1.65, rate: 24, end: 4.34 }; // deg/s+export const ORBIT_TOTAL = ORBIT.rate * (ORBIT.end - ORBIT.start); // 39.36deg++export const POP = { start: 1.95, stagger: 0.17 }; // slower stagger: each chip reads on arrival+export const ABSORB = { start: 3.2, stagger: 0.21, duration: 0.3 };++export function absorbAt(k: number): number {+ return ABSORB.start + k * ABSORB.stagger;+}++/* ---------------------------------------------------------------------- chat panel */++// Outer shell 646x232, dead centre of the stage. Rises from centre y 566 (+116).+export const PANEL = {+ w: 646,+ h: 232,+ left: 397,+ top: 334,+ riseY: 116,+ pad: 8,+ gap: 8,+ sidebarW: 186,+ messageW: 436,+ messagePad: 16,+};++export const PANEL_INNER = {+ left: PANEL.left + PANEL.pad, // 405+ top: PANEL.top + PANEL.pad, // 342+ h: PANEL.h - PANEL.pad * 2, // 216+};++export const MESSAGE_AREA = {+ left: PANEL_INNER.left + PANEL.sidebarW + PANEL.gap + PANEL.messagePad, // 615+ top: PANEL_INNER.top + PANEL.messagePad, // 358+ w: PANEL.messageW - PANEL.messagePad * 2, // 404+ h: PANEL_INNER.h - PANEL.messagePad * 2, // 184+};++export const CHANNELS = [+ '#product-launch',+ '#switch-ux-improvements',+ '#customer-support',+ '#weekly-report',+];++/*+ * Message rows sit at their final positions in one stack container; the push-up is a single+ * `y` on that container, clipped by the message area. Bottom-anchoring falls straight out of+ * it — a row that hasn't arrived yet is simply below the clip:+ *+ * stackY | lassya | writer | builder (message area is 358..542)+ * 130 | 500 ok| 554 cut| 630 cut+ * 54 | 424 ok| 478 ok | 554 cut+ * 0 | 370 ok| 424 ok | 500 ok+ *+ * Transform-only, no height or layout change anywhere in the piece.+ *+ * Row heights: 40px avatar tile, or name(20) + body lines(22 each), whichever is taller.+ */+const ROW_GAP = 12;+export const MESSAGES: [Message<'lassya'>, Message<'writer'>, Message<'builder'>] = [+ // Lassya's body is rendered inline in ChatPanel because of the @mention pills.+ { id: 'lassya', author: 'Lassya', lines: [], h: 42 },+ {+ id: 'writer',+ author: 'writer',+ lines: ["I'm here!", 'Read the docs, got all the tools'],+ h: 64,+ },+ { id: 'builder', author: 'builder', lines: ['Yup. Ready to go!'], h: 42 },+];++const STACK_H = MESSAGES.reduce((n, m) => n + m.h, 0) + ROW_GAP * (MESSAGES.length - 1); // 172+export const STACK_TOP = MESSAGE_AREA.top + MESSAGE_AREA.h - STACK_H; // bottom-anchored++function placeRow<Id extends MessageId>(m: Message<Id>, i: number): MessageRow<Id> {+ const top = STACK_TOP + MESSAGES.slice(0, i).reduce((n, p) => n + p.h + ROW_GAP, 0);+ return { ...m, top, tileCx: MESSAGE_AREA.left + 20, tileCy: top + 20 };+}++export const ROWS: [MessageRow<'lassya'>, MessageRow<'writer'>, MessageRow<'builder'>] = [+ placeRow(MESSAGES[0], 0),+ placeRow(MESSAGES[1], 1),+ placeRow(MESSAGES[2], 2),+];++/*+ * Both agent rows now open on the same beat — the mark plunges in and the agents come+ * straight back out like droplets off the splash — so the stack only has two states.+ * The three-state derivation above still holds; the 54 step is simply never used.+ */+export const STACK_Y = { closed: 130, open: 0 };++/* ------------------------------------------------- the plunge and the surface break */++export const FALL = { at: 5.84, duration: 0.22 };+export const FALL_EASE: CubicBezier = [0.55, 0, 1, 1]; // hard acceleration — a plunge, not a descent+export const FALL_STRETCH = 1.14;+export const FALL_SQUEEZE = 0.92;++/*+ * The surface glow on entry — the agents' power-up bloom applied to the whole messaging UI,+ * much more restrained. Blue and orange offset from each other so the panel briefly carries+ * the colour of both agents that just came out of it.+ *+ * Each stop fades to its own hue at zero alpha; `transparent` is rgba(0,0,0,0) and fringes grey.+ */+export const PANEL_GLOW = {+ bleed: 44, // how far past the panel the halo extends+ blur: 30,+ peak: 0.34, // deliberately low — a tint, not a flash+ duration: 0.78,+ background:+ 'radial-gradient(62% 82% at 32% 38%, rgba(161,201,210,0.95) 0%, rgba(161,201,210,0) 72%), ' ++ 'radial-gradient(62% 82% at 70% 64%, rgba(255,137,94,0.95) 0%, rgba(255,137,94,0) 72%)',+};++/** Solve a cubic-bezier easing for the normalized TIME at which it reaches `value`. */+function easeTimeAt([x1, y1, x2, y2]: CubicBezier, value: number): number {+ const bez = (a: number, b: number, u: number): number =>+ 3 * (1 - u) ** 2 * u * a + 3 * (1 - u) * u ** 2 * b + u ** 3;+ let lo = 0;+ let hi = 1;+ for (let i = 0; i < 50; i += 1) {+ const mid = (lo + hi) / 2;+ if (bez(y1, y2, mid) < value) lo = mid;+ else hi = mid;+ }+ return bez(x1, x2, (lo + hi) / 2);+}++// Fraction of the fall's DISTANCE at which the mark's visual top meets the panel's top edge.+// The mark is stretching as it falls, so its own scale is part of the crossing.+const SURFACE_D =+ (PANEL.top - (MARK.cy + TOSS.apex - MARK.size / 2)) /+ (TOSS.landed - TOSS.apex - (MARK.size / 2) * (FALL_STRETCH - 1));++/*+ * The surface break: the frame the mark enters the water. Worth knowing that this is 73% of+ * the fall's DISTANCE but 85% of its DURATION — the fall ease is hard-accelerating, so the+ * last stretch of travel costs almost no time and the mark is fully under ~30ms after the+ * agents are thrown off it.+ */+export const SURFACE = FALL.at + FALL.duration * easeTimeAt(FALL_EASE, SURFACE_D);++/* ------------------------------------------------------------------- eject geometry */++/*+ * The splash. Each agent breaks back out of the water on ITS OWN frame rather than on the+ * mark's: the builder sits 52px lower inside the mark, so it goes under first and comes+ * back out first, and each one surfaces at the panel's top edge instead of climbing all the+ * way up from wherever the mark happened to be when its roof went under.+ *+ * The plunge is hard-accelerating, though, so the builder's head start is only 29ms — far+ * too close to read as two events. The writer therefore holds under a beat longer, which+ * widens the gap to something the eye can actually count. Everything after the writer's+ * entrance is shifted by the same hold, so the dialogue keeps its own spacing.+ */+export const SPLASH = {+ submerge: 8, // how far past the top edge the agent's centre is when it breaks back out+ rise: 58, // how high above the edge the droplet peaks+ gravity: 3200, // px/s^2 — one world, so both droplets fall under the same g+ hold: { builder: 0, writer: 0.13 },+};++/*+ * Real ballistics, because anything else shows.+ *+ * The flight used to be a spring on x against a three-keyframe arc on y. Those are two+ * independent motions: the spring settled in ~0.3s while the arc was still climbing, so the+ * horizontal was spent before the fall began and the path read as straight up, pause,+ * straight down. A projectile is not two motions — it is ONE launch velocity and gravity.+ *+ * So: x runs at a constant rate for the whole flight, y is `-v0*t + g*t^2/2` sampled as a+ * dense polyline, and the two compose into the parabola. Both agents launch at the same+ * speed from the same splash and fall under the same g, so the builder — which has further+ * to drop to its row — is genuinely in the air longer. Nothing about the shape is authored;+ * the only design inputs are how high it pops and how hard gravity pulls.+ */+const APEX_H = SPLASH.rise + SPLASH.submerge; // apex height above the launch point+const LAUNCH_V = Math.sqrt(2 * SPLASH.gravity * APEX_H); // up is negative on screen++/** How long this droplet is in the air, given how far below the launch it comes down. */+function flightTime(dy: number): number {+ const g = SPLASH.gravity;+ return (LAUNCH_V + Math.sqrt(LAUNCH_V * LAUNCH_V + 2 * g * dy)) / g;+}++// Linear interpolation between keyframes is a chord across the parabola; at this density the+// worst-case sag is well under a pixel, so the polyline IS the curve.+const BALLISTIC_STEPS = 16;++/** The y track for one flight, as keyframes + their normalized times. */+export function ballistic(e: EjectTarget): { ys: number[]; times: number[] } {+ const ys: number[] = [];+ const times: number[] = [];+ for (let i = 0; i <= BALLISTIC_STEPS; i += 1) {+ const p = i / BALLISTIC_STEPS;+ const t = p * e.flight;+ ys.push(-LAUNCH_V * t + (SPLASH.gravity / 2) * t * t);+ times.push(p);+ }+ ys[ys.length - 1] = e.dy; // land exactly on the tile rather than within rounding of it+ return { ys, times };+}++/*+ * The fall progress at which an agent's centre passes `SPLASH.submerge` below the panel's+ * top edge. The agent's screen position is linear in the progress — the mark's displacement+ * and its stretch are both linear — so this inverts directly instead of being solved for.+ */+function submergeD(key: AgentKey): number {+ const a = AVATARS[key];+ const offset = a.cy - MARK.size / 2; // the agent's centre, in mark units from mark centre+ const at0 = MARK.cy + TOSS.apex + offset;+ const perD = TOSS.landed - TOSS.apex + offset * (FALL_STRETCH - 1);+ return (PANEL.top + SPLASH.submerge - at0) / perD;+}++/*+ * An agent flies to the position its row tile *settles* at, not to a moving target. The+ * stack spring and the two flights run together, so there is a little drift mid-flight —+ * that reads as the agent homing in.+ */+function ejectTarget(key: AgentKey, rowIndex: number): EjectTarget {+ const a = AVATARS[key];+ const half = MARK.size / 2;+ // measured at this agent's own break, through the mark's live displacement and stretch+ const d = submergeD(key);+ const fromX = MARK.cx + (a.cx - half) * (1 - (1 - FALL_SQUEEZE) * d);+ const fromY =+ MARK.cy ++ TOSS.apex ++ (TOSS.landed - TOSS.apex) * d ++ (a.cy - half) * (1 + (FALL_STRETCH - 1) * d);+ const row = ROWS[rowIndex];+ /*+ * The stack opens fully on impact, so both agents fly to a tile that is already at its+ * final resting place: writer 444, builder 520, both inside the 358..542 clip.+ *+ * The flight itself is a projectile — see `ballistic` above. All this has to supply is+ * where it starts, where it comes down, and how long it is in the air.+ */+ const dy = row.tileCy + STACK_Y.open - fromY;+ return {+ at: FALL.at + FALL.duration * easeTimeAt(FALL_EASE, d) + SPLASH.hold[key],+ flight: flightTime(dy),+ fromLeft: fromX - a.box / 2,+ fromTop: fromY - a.box / 2,+ dx: row.tileCx - fromX,+ dy,+ };+}++// builder first — it is the lower of the two inside the mark, so it goes under first+export const EJECT: Record<AgentKey, EjectTarget> = {+ builder: ejectTarget('builder', 2),+ writer: ejectTarget('writer', 1),+};++/* ------------------------------------------------------------------------ the clock */++/*+ * Everything from here is hung off the moment the writer's droplet lands rather than on+ * absolute beats, so retiming the splash — its hold, its arc — carries the dialogue and the+ * running time with it instead of squeezing them against the landings.+ */+const LANDED = EJECT.writer.at + EJECT.writer.flight;++export const SETTLE = LANDED + 0.96;+export const DURATION = SETTLE + 0.35;++/*+ * The tail, as a plunge into a pool. The mark breaks the panel's top edge and keeps going+ * until it is gone under opaque white — it never fades. The two agents are the droplets+ * thrown off at the moment of the break, not at the bottom of the fall, and a ripple spreads+ * outward from the point of entry. Lassya's message lands on the break; both rows open at+ * once; each agent speaks as it lands.+ *+ * No typing indicators — the avatar arriving is the arrival signal, and dots after it are a+ * slower second beat saying the same thing.+ */++// The gaps between the lines are the ones the piece was tuned with.+export const TAIL: Record<AgentKey, AgentBeat> & {+ lassya: number;+ stack: number;+ settle: number;+} = {+ lassya: SURFACE,+ stack: SURFACE + 0.05,+ writer: { open: EJECT.writer.at, say: LANDED + 0.1, line2: LANDED + 0.22 },+ builder: { open: EJECT.builder.at, say: LANDED + 0.34 },+ settle: SETTLE,+};++/* ------------------------------------------------------------------- the beat sheet */++const LAUNCH_EASE: CubicBezier = [0.12, 0.72, 0.3, 1];++/**+ * The whole piece as one framer-motion sequence. Every segment carries an absolute `at:`+ * offset, so the array reads top-to-bottom as the beat sheet and nothing is order-dependent.+ *+ * @param clock seconds elapsed, drives the eyes+ */+export function buildSequence(clock: MotionValue<number>): AnimationSequence {+ const seq: AnimationSequence = [];++ // Master clock — one linear ramp so the eye system and the sequence share a single+ // playback head.+ seq.push([clock, [0, DURATION], { duration: DURATION, ease: 'linear', at: 0 }]);++ /* --- Act 1: the mark (0.00 - 1.65) ------------------------------------------- */++ // Springs carry their own overshoot and their own duration. framer-motion only honours a+ // spring on a two-keyframe segment, and a `duration` alongside stiffness/damping silently+ // switches it to a duration-based spring — so spring beats are always [from, to] with no+ // duration, and opacity rides alongside as its own plain tween.+ seq.push([+ '.mark-body',+ { scale: [0.82, 1] },+ { at: 0.15, type: 'spring', stiffness: 420, damping: 26 },+ ]);+ seq.push(['.mark-body', { opacity: [0, 1] }, { at: 0.15, duration: 0.18, ease: 'easeOut' }]);++ /*+ * Hollow-out: a real thinning, not an outline of the original. One thickness drives both+ * halves of the rig — the outer ring is stroked at 2T and clipped to itself so exactly T+ * shows inward, and the divider is a line of width T across the gap band.+ */+ seq.push([+ '.mark-ring',+ { strokeWidth: [MARK_T.from * 2, MARK_T.to * 2] },+ { at: MARK_T.at, duration: MARK_T.duration, ease: MARK_T.ease },+ ]);+ seq.push([+ '.mark-divider',+ { strokeWidth: [MARK_T.from, MARK_T.to] },+ { at: MARK_T.at, duration: MARK_T.duration, ease: MARK_T.ease },+ ]);+ // The exact filled logo hands over to the rig in the first 120ms, while it is still thick.+ // The rig is opaque from the start and sits UNDERNEATH, so only the top layer fades: the+ // composite stays 100% black throughout instead of dipping to ~75% mid-crossfade. All the+ // fade actually reconciles is the inner corner radii, which is the one place they differ.+ seq.push(['.mark-solid', { opacity: [1, 0] }, { at: MARK_T.at, duration: 0.12 }]);+ // the pips shrink into themselves across the last 40% — gone by the line state+ seq.push([+ '.mark-pip',+ { scale: [1, 0], opacity: [1, 0] },+ { at: MARK_T.at + MARK_T.duration * 0.6, duration: MARK_T.duration * 0.4, ease: 'easeIn' },+ ]);++ seq.push([+ '.mark-body',+ { scale: [1, 1.07] },+ { at: MARK_T.at, duration: MARK_T.duration, ease: 'easeOut' },+ ]);+ seq.push([+ '.mark-body',+ { scale: [1.07, 1] },+ { at: MARK_T.at + MARK_T.duration, type: 'spring', stiffness: 380, damping: 28 },+ ]);++ /* --- Act 2: the agents (1.22 - 2.10), overlapping the tail of the morph ------ */++ (+ [+ ['.agent-writer', 1.22],+ ['.agent-builder', 1.39],+ ] as const+ ).forEach(([sel, at]) => {+ seq.push([+ sel,+ { y: [18, 0], scale: [0.4, 1] },+ { at, type: 'spring', stiffness: 500, damping: 17 },+ ]);+ seq.push([sel, { opacity: [0, 1] }, { at, duration: 0.16, ease: 'easeOut' }]);+ });++ /* --- Act 3: capabilities (1.65 - 4.34) --------------------------------------- */++ POP_ORDER.forEach((chipIndex, k) => {+ const chip = CHIPS[chipIndex];+ const at = POP.start + k * POP.stagger;+ seq.push([+ `.chip-${chip.id}`,+ { scale: [0, 1], rotate: [chip.jitter, 0] },+ { at, type: 'spring', stiffness: 520, damping: 16 },+ ]);+ seq.push([`.chip-${chip.id}`, { opacity: [0, 1] }, { at, duration: 0.14, ease: 'easeOut' }]);+ });++ // Orbit: a shared rotation on the ring container. Chips counter-rotate so labels stay upright.+ const orbitDur = ORBIT.end - ORBIT.start;+ seq.push([+ '.chip-orbit',+ { rotate: [0, ORBIT_TOTAL] },+ { at: ORBIT.start, duration: orbitDur, ease: 'linear' },+ ]);+ CHIPS.forEach((chip) => {+ seq.push([+ `.chip-counter-${chip.id}`,+ { rotate: [0, -ORBIT_TOTAL] },+ { at: ORBIT.start, duration: orbitDur, ease: 'linear' },+ ]);+ });++ // Spiral absorption — a different fixed order. The chip translates toward the ring centre+ // in the ring's own (rotating) frame, so the orbit bends the straight pull into a spiral.+ ABSORB_ORDER.forEach((chipIndex, k) => {+ const chip = CHIPS[chipIndex];+ const at = absorbAt(k);+ const rad = (chip.angle * Math.PI) / 180;+ seq.push([+ `.chip-${chip.id}`,+ {+ x: [0, -chip.r * Math.cos(rad)],+ y: [0, -chip.r * Math.sin(rad)],+ scale: [1, 0.25],+ },+ { at, duration: ABSORB.duration, ease: 'easeIn' },+ ]);+ seq.push([+ `.chip-${chip.id}`,+ { opacity: [1, 0] },+ { at: at + ABSORB.duration - 0.12, duration: 0.12, ease: 'linear' },+ ]);++ // Power-up: each agent blooms in its own colour, plus a mark pulse and an agent pop.+ // The opacity track opens on 0 on purpose — a sequence track holds its FIRST keyframe+ // from t=0, so anything that opens non-zero is parked on screen before the piece starts.+ const hit = at + ABSORB.duration - 0.04;+ (['writer', 'builder'] as const).forEach((agent) => {+ seq.push([+ `.glow-${agent}-${k}`,+ { opacity: [0, 0.85, 0], scale: [0.8, 1.1, 1.35] },+ { at: hit, duration: 0.45, times: [0, 0.3, 1], ease: 'easeOut' },+ ]);+ });+ seq.push(['.mark-body', { scale: [1, 1.05, 1] }, { at: hit, duration: 0.18 }]);+ ['.agent-writer', '.agent-builder'].forEach((sel, i) => {+ seq.push([+ sel,+ { scale: [1, 1.14, 1], rotate: [0, i === 0 ? 3 : -3, 0] },+ { at: hit, duration: 0.26 },+ ]);+ });+ });++ /* --- Act 4: the toss (5.00 - 6.06) ------------------------------------------- */++ // anticipation / squash+ seq.push([+ '.mark-body',+ { scaleY: [1, 0.8], scaleX: [1, 1.18] },+ { at: 5.0, duration: 0.16, ease: 'easeOut' },+ ]);+ seq.push(['.mark-layer', { y: [0, 10] }, { at: 5.0, duration: 0.16, ease: 'easeOut' }]);+ ['.agent-writer', '.agent-builder'].forEach((sel) => {+ seq.push([sel, { scaleY: [1, 0.86], scaleX: [1, 1.1] }, { at: 5.0, duration: 0.16 }]);+ });++ // launch / stretch+ seq.push([+ '.mark-body',+ { scaleY: [0.8, 1.22], scaleX: [1.18, 0.88] },+ { at: 5.16, duration: 0.42, ease: LAUNCH_EASE },+ ]);+ seq.push([+ '.mark-layer',+ { y: [10, TOSS.apex] },+ { at: 5.16, duration: 0.42, ease: LAUNCH_EASE },+ ]);+ ['.agent-writer', '.agent-builder'].forEach((sel) => {+ seq.push([sel, { scaleY: [0.86, 1], scaleX: [1.1, 1] }, { at: 5.16, duration: 0.42 }]);+ });++ // apex hang / weightless — the avatars float up and kiss their slot ceilings+ seq.push([+ '.mark-body',+ { scaleY: [1.22, 1], scaleX: [0.88, 1] },+ { at: 5.58, type: 'spring', stiffness: 220, damping: 22 },+ ]);+ ['.agent-writer', '.agent-builder'].forEach((sel) => {+ seq.push([+ sel,+ { y: [0, FLOAT_Y, FLOAT_Y + 1] },+ { at: 5.58, duration: 0.26, times: [0, 0.85, 1], ease: 'easeOut' },+ ]);+ });++ // fall+ seq.push([+ '.mark-layer',+ { y: [TOSS.apex, TOSS.landed] },+ { at: FALL.at, duration: FALL.duration, ease: FALL_EASE },+ ]);+ seq.push([+ '.mark-body',+ { scaleY: [1, FALL_STRETCH], scaleX: [1, FALL_SQUEEZE] },+ { at: FALL.at, duration: FALL.duration, ease: FALL_EASE },+ ]);++ /*+ * No impact squash on the mark. By the time it lands it is entirely under opaque white, so+ * anything it does down there is invisible — that energy goes to the surface it hit+ * instead, as the ripple below. And it gets no exit animation at all: it is simply gone,+ * because something opaque is in front of it.+ */++ /* --- chat panel arrival (5.45 - 6.02), staggered against the toss ------------ */++ seq.push([+ '.chat-panel',+ { y: [PANEL.riseY, 0], opacity: [0, 1] },+ { at: 5.45, duration: 0.52, ease: 'easeOut' },+ ]);+ CHANNELS.forEach((_, i) => {+ seq.push([+ `.channel-${i}`,+ { y: [8, 0], opacity: [0, 1] },+ { at: 5.78 + i * 0.055, duration: 0.24, ease: 'easeOut' },+ ]);+ });+ seq.push([+ '.channel-active-bg',+ { opacity: [0, 1] },+ { at: 6.0, duration: 0.18, ease: 'easeOut' },+ ]);++ /* --- Acts 5 + 6: the plunge and the splash (6.03 - 6.97) --------------------- */++ /*+ * The mark plunges in and the agents come straight back out of it, like droplets off the+ * splash. Lassya's message is already landing on the impact frame; both rows open on one+ * spring; both agents eject 100ms apart and overlap heavily in flight; each speaks as it+ * lands. Nothing waits for the beat before it.+ */++ // Lassya lands with the impact. Her row is the only one in view, so it sits at the bottom.+ seq.push([+ '.msg-lassya',+ { y: [14, 0], opacity: [0, 1] },+ { at: TAIL.lassya, duration: 0.24, ease: 'easeOut' },+ ]);+ seq.push([+ '.mention-writer',+ { backgroundColor: ['rgba(161,201,210,0)', 'rgba(161,201,210,0.4)'] },+ { at: TAIL.lassya + 0.12, duration: 0.12 },+ ]);+ seq.push([+ '.mention-builder',+ { backgroundColor: ['rgba(255,137,94,0)', 'rgba(255,137,94,0.34)'] },+ { at: TAIL.lassya + 0.21, duration: 0.12 },+ ]);++ // Both rows open at once — one spring on the whole stack. This is what gives both agents+ // a real target at impact time: at stackY 0 the tiles rest at 444 and 520, both inside+ // the 358..542 clip, so neither flies at a row that is still below the fold.+ seq.push([+ '.msg-stack',+ { y: [STACK_Y.closed, STACK_Y.open] },+ { at: TAIL.stack, type: 'spring', stiffness: 380, damping: 30 },+ ]);++ (['writer', 'builder'] as const).forEach((key) => {+ const beat = TAIL[key];+ const e = EJECT[key];+ const arc = ballistic(e);+ // The hand-off is the landing frame itself — the clone touches the tile and the row's+ // own avatar takes over on the same pixels. Never after the agent has spoken, though:+ // a glyph arriving late reads as a bug.+ const land = Math.min(beat.open + e.flight, beat.say - 0.01);++ // The agent climbs out of the logo. Same pixels, same frame: the clipped in-slot agent+ // hands off to the free-flying clone.+ seq.push([`.agent-${key}`, { opacity: [1, 0] }, { at: beat.open, duration: 0.001 }]);+ seq.push([`.eject-${key}`, { opacity: [0, 1] }, { at: beat.open, duration: 0.001 }]);+ // Horizontal velocity is constant — that is what makes the path a parabola rather than+ // two moves that happen to overlap. No spring: a spring has its own acceleration curve,+ // and gravity is already the only acceleration in this flight.+ seq.push([+ `.eject-${key}`,+ { x: [0, e.dx] },+ { at: beat.open, duration: e.flight, ease: 'linear' },+ ]);+ seq.push([+ `.eject-${key}`,+ { y: arc.ys },+ { at: beat.open, duration: e.flight, times: arc.times, ease: 'linear' },+ ]);+ seq.push([+ `.eject-${key}`,+ { scale: [1, AVATARS[key].ejectScale * 1.12, AVATARS[key].ejectScale] },+ { at: beat.open, duration: e.flight, times: [0, 0.86, 1], ease: 'easeOut' },+ ]);++ // the tile arrives with the row, so the agent lands on something+ seq.push([+ `.tile-${key}`,+ { opacity: [0, 1] },+ { at: TAIL.stack, duration: 0.2, ease: 'easeOut' },+ ]);++ // Landed. Swap the free-flying clone for the row's own avatar, so from here the agent+ // belongs to the stack rather than floating over it.+ seq.push([`.eject-${key}`, { opacity: [1, 0] }, { at: land, duration: 0.001 }]);+ seq.push([`.rowavatar-${key}`, { opacity: [0, 1] }, { at: land, duration: 0.001 }]);++ // speech, on landing — no typing indicator; the avatar arriving is the arrival signal+ seq.push([+ `.msg-${key}-0`,+ { y: [14, 0], opacity: [0, 1] },+ { at: beat.say, duration: 0.24, ease: 'easeOut' },+ ]);+ if (beat.line2) {+ seq.push([+ `.msg-${key}-1`,+ { y: [14, 0], opacity: [0, 1] },+ { at: beat.line2, duration: 0.24, ease: 'easeOut' },+ ]);+ }+ });++ /*+ * The surface glows where it was hit: one soft bloom across the whole panel in both agent+ * colours. No rings — Max asked for the power-up glow, scaled up and dialled down.+ *+ * The opacity track opens on 0 on purpose: a framer-motion sequence holds a track's FIRST+ * keyframe from t=0, not the element's inline style, so a non-zero opening value would park+ * a visible wash on screen before the piece begins.+ */+ seq.push([+ '.panel-glow',+ { opacity: [0, PANEL_GLOW.peak, 0] },+ { at: SURFACE, duration: PANEL_GLOW.duration, times: [0, 0.18, 1], ease: 'easeOut' },+ ]);+ seq.push([+ '.panel-glow',+ { scale: [0.98, 1.04] },+ { at: SURFACE, duration: PANEL_GLOW.duration, ease: 'easeOut' },+ ]);++ return seq;+}++/* ============================================================================ eyes ==+ *+ * Saccades and blinks are seeded pseudo-random — a fixed schedule computed once at module+ * load, never Math.random() at runtime, so the piece plays identically every time.+ * Gaze targeting overrides the idle schedule whenever the agents should be paying+ * attention to something: the orbiting chips, each absorption, the arriving panel, each+ * incoming message.+ */++// Pupil travel, in SVG user units (the avatars render at ~0.14 scale in the slots).+const PUPIL_X = 18;+const PUPIL_Y = 12;++function hash(seed: number, n: number): number {+ const x = Math.sin(seed * 12.9898 + n * 78.233) * 43758.5453;+ return x - Math.floor(x);+}++function buildSaccades(seed: number, from: number, to: number): Saccade[] {+ const out: Saccade[] = [];+ let t = from;+ for (let i = 0; t < to; i += 1) {+ t += 0.7 + hash(seed, i) * 0.9; // 700-1600ms dwell+ out.push({+ at: t,+ x: (hash(seed, i + 101) * 2 - 1) * PUPIL_X,+ y: (hash(seed, i + 211) * 2 - 1) * PUPIL_Y,+ });+ }+ return out;+}++function buildBlinks(seed: number, from: number, to: number, extra: number[]): number[] {+ const out = [...extra];+ let t = from;+ for (let i = 0; t < to; i += 1) {+ t += 2.4 + hash(seed, i + 37) * 2.4; // every 2.4-4.8s+ if (t < to) out.push(t);+ }+ return out.sort((a, b) => a - b);+}++const EYE_SCHEDULE = {+ // first blink at 1.70 / 1.79 (90ms offset), settle blinks at 7.30 / 7.40 — never in unison+ writer: {+ saccades: buildSaccades(11, 1.7, DURATION),+ blinks: buildBlinks(11, 1.9, DURATION, [1.7, 7.3]),+ },+ builder: {+ saccades: buildSaccades(29, 1.7, DURATION),+ blinks: buildBlinks(29, 1.9, DURATION, [1.79, 7.4]),+ },+};++const BLINK_DUR = 0.14;++/** Shared orbit rotation at time t, in degrees. */+function orbitDelta(t: number): number {+ if (t <= ORBIT.start) return 0;+ return Math.min(ORBIT.rate * (t - ORBIT.start), ORBIT_TOTAL);+}++/** Unit direction toward a chip, in pupil units. */+function towardChip(chipIndex: number, t: number): Gaze {+ const chip = CHIPS[chipIndex];+ const rad = ((chip.angle + orbitDelta(t)) * Math.PI) / 180;+ return { x: Math.cos(rad) * PUPIL_X, y: Math.sin(rad) * PUPIL_Y };+}++/*+ * Two chips per agent for the whole chip act, picked on opposite sides of the ring: the+ * writer takes the upper-left then the upper-right, the builder the lower-right then the+ * lower-left. So the pair covers the ring between them and the two are never pointing the+ * same way. The hand-offs are 180ms apart so they don't move in unison.+ */+const CHIP_GAZE = {+ writer: { chips: [0, 4], switchAt: 2.6 }, // Models (upper-left) -> Connections (upper-right)+ builder: { chips: [3, 2], switchAt: 2.78 }, // Permissions (lower-right) -> Instructions (lower-left)+};++/*+ * The power-up smile: the pupils give way to happy arcs while the capabilities land, from+ * the first absorption hit to a beat after the last. Derived from the absorb beats, so+ * retiming the absorptions retimes the smile with them.+ */+export const SMILE = {+ from: absorbAt(0) + ABSORB.duration - 0.1, // 3.40+ to: absorbAt(ABSORB_ORDER.length - 1) + ABSORB.duration + 0.34, // 4.68+};++/**+ * Smile at time t: 1 = happy arcs, 0 = round pupils. A hard swap on both edges — a fade+ * puts both eye treatments on screen at once, which reads as a ghost rather than a change+ * of expression.+ */+function smileAt(t: number): number {+ return t >= SMILE.from && t < SMILE.to ? 1 : 0;+}++/**+ * Where an agent is deliberately looking at time t, or null to fall back to idle saccades.+ */+function gazeAt(agent: AgentKey, t: number): Gaze | null {+ /*+ * Act 3 — the chips. Tracking every chip as it popped and again as it was absorbed gave+ * each agent ten gaze hand-offs inside 2.5s, which read as frantic. Each agent now takes+ * two chips and smooth-tracks them through the orbit; once the absorptions start, the+ * smile takes over and the eyes stop moving entirely.+ */+ if (t >= POP.start && t < SMILE.from) {+ const g = CHIP_GAZE[agent];+ return towardChip(t < g.switchAt ? g.chips[0] : g.chips[1], t);+ }+ /*+ * Out of the smile and into the toss, the eyes open centred and hold. Dropping back to+ * idle saccades here spends the calm the smile just bought, on nothing.+ */+ if (t >= SMILE.from && t < 5.45) return { x: 0, y: 0 };+ // Act 4 — the panel builds itself underneath; each agent looks down at it until its own+ // launch, which is no longer the same frame for both.+ if (t >= 5.45 && t < TAIL[agent].open) return { x: 0, y: PUPIL_Y * 0.9 };++ // Each agent watches its own row as it flies into it — gaze follows the flight vector.+ const own = TAIL[agent];+ if (own && t >= own.open && t < own.open + EJECT[agent].flight) {+ const e = EJECT[agent];+ const len = Math.hypot(e.dx, e.dy);+ return { x: (e.dx / len) * PUPIL_X, y: (e.dy / len) * PUPIL_Y };+ }++ // Impact: Lassya's message lands below them, to the right of her avatar.+ if (t >= TAIL.lassya && t < TAIL.writer.say) return { x: PUPIL_X * 0.5, y: PUPIL_Y * 0.9 };++ // Landed: both sit in the avatar column, so a message is always off to the right — its own+ // (level) or the other agent's (above if the speaker is the writer, below if the builder).+ if (t >= TAIL.writer.say && t < TAIL.builder.say) {+ return agent === 'writer'+ ? { x: PUPIL_X * 0.85, y: -PUPIL_Y * 0.3 }+ : { x: PUPIL_X * 0.7, y: -PUPIL_Y * 0.8 };+ }+ if (t >= TAIL.builder.say && t < TAIL.settle) {+ return agent === 'builder'+ ? { x: PUPIL_X * 0.85, y: -PUPIL_Y * 0.3 }+ : { x: PUPIL_X * 0.6, y: PUPIL_Y * 0.8 };+ }+ if (t >= TAIL.settle) return { x: 0, y: 0 }; // recentre on the settle+ return null;+}++/**+ * Deterministic eye state for one agent at time t.+ * @returns pupil offset in SVG units, eyelid scaleY, and the smile (0 or 1)+ */+export function eyeState(agent: AgentKey, t: number): EyeState {+ const sched = EYE_SCHEDULE[agent];+ const smile = smileAt(t);++ // No blinking while the smile is up — the arcs have no lid to close.+ let blink = 1;+ if (smile === 0) {+ for (let i = 0; i < sched.blinks.length; i += 1) {+ const d = t - sched.blinks[i];+ if (d >= 0 && d <= BLINK_DUR) {+ const p = d / BLINK_DUR;+ blink = p < 0.5 ? 1 - (p / 0.5) * 0.92 : 0.08 + ((p - 0.5) / 0.5) * 0.92;+ break;+ }+ }+ }++ const gaze = gazeAt(agent, t);+ if (gaze) return { ...gaze, blink, smile };++ let target: Gaze = { x: 0, y: 0 };+ for (let i = 0; i < sched.saccades.length; i += 1) {+ if (sched.saccades[i].at > t) break;+ target = sched.saccades[i];+ }+ return { x: target.x, y: target.y, blink, smile };+}diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-flow.tsx b/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-flow.tsxindex 787282b44..fbe146ba5 100644--- a/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-flow.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-flow.tsx@@ -1,5 +1,5 @@import { observer } from 'mobx-react-lite';-import { useEffect, useState } from 'react';+import { Fragment, useEffect, useState } from 'react';import { buddyIntroStore } from '@renderer/features/switch-buddy/buddy-intro-store';import { BuddyStep } from '@renderer/features/switch-buddy/buddy-step';import { openBuddyChat } from '@renderer/features/switch-buddy/open-buddy';@@ -24,6 +24,7 @@ import type { SwitchServer } from '@shared/core/switch-servers/switch-servers';import type { RendererTelemetryEvents } from '@shared/core/telemetry/renderer-events';import { CreateWorkspacePage } from './create-workspace-page';import { type CloudChoiceState, HowToRunPage } from './how-to-run-page';+import { OnboardingIntro } from './onboarding-intro';import { onboardingStore, type OnboardingPage } from './onboarding-store';import { PickWorkspacePage } from './pick-workspace-page';import { WelcomePage } from './welcome-page';@@ -184,7 +185,10 @@ export const OnboardingFlow = observer(function OnboardingFlow() {return (<WizardChromeProvider chrome="page" exit={exit}>- {currentPage(server, cloudChoice, goTo, finish, finishWithBuddy)}+ {/* Keyed by page, so each one opens afresh, with its entrance. */}+ <Fragment key={page}>+ {currentPage(server, cloudChoice, goTo, finish, finishWithBuddy)}+ </Fragment></WizardChromeProvider>);});@@ -240,6 +244,8 @@ function currentPage() {switch (onboardingStore.page) {case 'welcome':+ if (onboardingStore.introPending)+ return <OnboardingIntro onDone={() => onboardingStore.introPlayed()} />;return (<WelcomePageonContinue={() => goTo('howToRun')}diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-intro.tsx b/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-intro.tsxnew file mode 100644index 000000000..2ceb7d358--- /dev/null+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-intro.tsx@@ -0,0 +1,144 @@+import { motion } from 'motion/react';+import {+ type CSSProperties,+ useCallback,+ useEffect,+ useLayoutEffect,+ useRef,+ useState,+} from 'react';+import { useTheme } from '@renderer/lib/hooks/useTheme';+import { Button } from '@renderer/lib/ui/button';+import aurora from './intro/assets/aurora.svg';+import './intro/fonts/intro-fonts.css';+import { introScale } from './intro/intro-scale';+import { IntroSequence } from './intro/IntroSequence';+import { STAGE, THEMES } from './intro/timeline';++/** How long the last frame holds before the intro gives way to Welcome. */+const HOLD_S = 0.5;+/**+ * The way out, at the end or on a skip: the chat rises and fades, the glow+ * behind it fades, and Welcome comes in after.+ */+const OUTRO = { duration: 0.42, ease: [0.4, 0, 0.2, 1] } as const;+/** How far the chat rises as it goes, in stage pixels. */+const OUTRO_RISE = 48;++/**+ * The intro that opens the first run, before Welcome: the Switch mark opens,+ * two agents take in what Switch does and step out into a conversation.+ *+ * The real window is its frame. It plays once at full size, smaller only in a+ * smaller window, in the app's theme, then fades into Welcome. A click, Esc or+ * Skip goes straight there; with reduced motion it shows its last frame.+ */+export function OnboardingIntro({ onDone }: { onDone: () => void }) {+ const { effectiveTheme } = useTheme();+ const frame = useRef<HTMLDivElement>(null);+ const [scale, setScale] = useState(1);+ const [leaving, setLeaving] = useState(false);+ const doneRef = useRef(onDone);+ doneRef.current = onDone;++ useLayoutEffect(() => {+ const element = frame.current;+ if (!element) return;+ const measure = () => setScale(introScale(element.getBoundingClientRect()));+ measure();+ const observer = new ResizeObserver(measure);+ observer.observe(element);+ return () => observer.disconnect();+ }, []);++ const leave = useCallback(() => setLeaving(true), []);++ useEffect(() => {+ const onKey = (event: KeyboardEvent) => {+ if (event.key === 'Escape') leave();+ };+ window.addEventListener('keydown', onKey);+ return () => window.removeEventListener('keydown', onKey);+ }, [leave]);++ const hold = useRef<ReturnType<typeof setTimeout> | null>(null);+ useEffect(+ () => () => {+ if (hold.current) clearTimeout(hold.current);+ },+ []+ );+ const finished = useCallback(() => {+ hold.current = setTimeout(leave, HOLD_S * 1000);+ }, [leave]);++ const theme = THEMES[effectiveTheme === 'emdark' ? 'dark' : 'light'] as CSSProperties;++ return (+ <div className="relative h-full w-full overflow-hidden bg-background" style={theme}>+ {/* The window can still be dragged by its top edge, as on every page. */}+ <div className="absolute inset-x-0 top-0 z-50 h-10 [-webkit-app-region:drag]" />+ <motion.div+ className="absolute top-3 right-3 z-50 [-webkit-app-region:no-drag]"+ initial={false}+ animate={{ opacity: leaving ? 0 : 1 }}+ transition={OUTRO}+ >+ <Button variant="ghost" size="sm" onClick={leave}>+ Skip+ </Button>+ </motion.div>+ <div+ ref={frame}+ className="absolute inset-0 flex cursor-default items-center justify-center"+ onClick={leave}+ >+ <div+ className="relative shrink-0"+ style={{ width: STAGE.w, height: STAGE.h, transform: `scale(${scale})` }}+ role="img"+ aria-label="Switch: the Switch mark opens, two agents appear inside it, take in five capabilities, and step out into a chat conversation."+ >+ {/*+ aurora.svg is the 1888x925 shape plus 300px of blur bleed on every+ side, so drawn at its natural size on the stage's centre it sits+ where the design has it, blur intact.+ */}+ <motion.div+ className="pointer-events-none absolute inset-0"+ initial={false}+ animate={{ opacity: leaving ? 0 : 1 }}+ transition={OUTRO}+ >+ <img+ src={aurora}+ alt=""+ aria-hidden+ className="pointer-events-none absolute"+ style={{+ width: 2488,+ height: 1525,+ left: 'calc(50% + 9px)',+ top: 'calc(50% + 181.5px)',+ transform: 'translate(-50%, -50%) rotate(180deg)',+ opacity: 'var(--sw-aurora-opacity)',+ mixBlendMode: 'var(--sw-aurora-blend)' as CSSProperties['mixBlendMode'],+ }}+ />+ </motion.div>+ <motion.div+ className="absolute inset-0"+ initial={false}+ animate={leaving ? { opacity: 0, y: -OUTRO_RISE } : { opacity: 1, y: 0 }}+ transition={OUTRO}+ onAnimationComplete={() => {+ if (leaving) doneRef.current();+ }}+ >+ <IntroSequence onComplete={finished} />+ </motion.div>+ </div>+ </div>+ </div>+ );+}diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-store.test.ts b/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-store.test.tsindex 21ea48a8d..93bb90003 100644--- a/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-store.test.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-store.test.ts@@ -1,6 +1,35 @@-import { describe, expect, it } from 'vitest';+import { describe, expect, it, vi } from 'vitest';++// The store reads whether the intro has played as it is created; Node has no localStorage.+vi.hoisted(() => {+ const stored = new Map<string, string>();+ globalThis.localStorage = {+ getItem: (key: string) => stored.get(key) ?? null,+ setItem: (key: string, value: string) => void stored.set(key, value),+ removeItem: (key: string) => void stored.delete(key),+ clear: () => stored.clear(),+ key: (index: number) => [...stored.keys()][index] ?? null,+ get length() {+ return stored.size;+ },+ };+});+import { onboardingStore } from './onboarding-store';+describe('the first-run intro', () => {+ it('plays on a fresh install, then not again until the pages are replayed', () => {+ expect(onboardingStore.introPending).toBe(true);+ onboardingStore.introPlayed();+ expect(onboardingStore.introPending).toBe(false);+ expect(localStorage.getItem('onboarding.introPlayed')).not.toBeNull();+ onboardingStore.reset();+ expect(onboardingStore.introPending).toBe(false);+ onboardingStore.rehearse();+ expect(onboardingStore.introPending).toBe(true);+ });+});+describe('replaying the first-run pages', () => {it('keeps the flow on screen from its welcome page', () => {onboardingStore.reset();diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-store.ts b/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-store.tsindex 1362a47a2..a91b55dfc 100644--- a/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-store.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/onboarding-store.ts@@ -28,6 +28,9 @@ export type OnboardingPage =* a form does not: the fields belong to the page drawing them, so a stray ⌘,* on the connect page costs the two addresses.*/+/** Where this install remembers the first-run intro has played. */+const INTRO_PLAYED_KEY = 'onboarding.introPlayed';+class OnboardingStore {page: OnboardingPage = 'welcome';/** The server the connect page added, and the subject of the pages after it. */@@ -61,6 +64,11 @@ class OnboardingStore {* skip, and offers a way back to the app from every page.*/rehearsal = false;+ /**+ * The intro still to play before Welcome: on the first run of this install,+ * and again when the pages are rehearsed.+ */+ introPending = localStorage.getItem(INTRO_PLAYED_KEY) === null;constructor() {makeAutoObservable(this);@@ -80,6 +88,13 @@ class OnboardingStore {rehearse(): void {this.reset();this.rehearsal = true;+ this.introPending = true;+ }++ /** The intro has played, or was skipped: Welcome is next, and it does not play again. */+ introPlayed(): void {+ localStorage.setItem(INTRO_PLAYED_KEY, new Date().toISOString());+ this.introPending = false;}goTo(page: OnboardingPage): void {diff --git a/console/apps/switch-console-desktop/src/renderer/features/onboarding/welcome-page.tsx b/console/apps/switch-console-desktop/src/renderer/features/onboarding/welcome-page.tsxindex f975ad00d..609b65280 100644--- a/console/apps/switch-console-desktop/src/renderer/features/onboarding/welcome-page.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/onboarding/welcome-page.tsx@@ -1,4 +1,5 @@import { MessagesSquare, ShieldCheck, Users } from 'lucide-react';+import { motion, useReducedMotion } from 'motion/react';import type { ReactNode } from 'react';import { UsageDataNotice } from '@renderer/features/telemetry/usage-data-line';import { SwitchConsoleAppIcon } from '@renderer/lib/switch-console-app-icon';@@ -10,6 +11,41 @@ import { OnboardingSurface, useWizardExit } from '@renderer/lib/ui/wizard-frame'* one button. Where it runs is the next page's question; this one only has to* say why anyone would want it to run at all.*/+/**+ * How Welcome's pieces arrive: each rises and fades in, a beat after the one+ * before and overlapping it, on a long ease-out, so the page assembles quickly+ * but settles softly. In reading order: icon, heading, the three points one+ * by one, the usage note, then the button.+ */+const ENTER_EASE = [0.22, 1, 0.36, 1] as const;+const ENTER_DURATION = 0.6;+const ENTER_STAGGER = 0.07;++function Enter({+ order,+ as = 'div',+ className,+ children,+}: {+ order: number;+ as?: 'div' | 'li';+ className?: string;+ children: ReactNode;+}) {+ const reduced = useReducedMotion() ?? false;+ const Element = as === 'li' ? motion.li : motion.div;+ return (+ <Element+ className={className}+ initial={reduced ? false : { opacity: 0, y: 18 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ duration: ENTER_DURATION, ease: ENTER_EASE, delay: order * ENTER_STAGGER }}+ >+ {children}+ </Element>+ );+}+export function WelcomePage({onContinue,onLeave,@@ -22,37 +58,59 @@ export function WelcomePage({return (<OnboardingSurfaceexit={onLeave ? { label: 'Back to the app', onExit: onLeave } : exit}- footer={<Button onClick={onContinue}>Get started</Button>}+ // Its pieces stage their own entrance, one after another.+ enter={false}+ footer={+ <Enter order={7}>+ <Button onClick={onContinue}>Get started</Button>+ </Enter>+ }><div className="flex flex-col items-center gap-10">- <SwitchConsoleAppIcon size={96} className="rounded-3xl" />- <h1 className="text-center text-3xl font-semibold">- Your teams, your agents, all in the same room- </h1>+ <Enter order={0}>+ <SwitchConsoleAppIcon size={96} className="rounded-3xl" />+ </Enter>+ <Enter order={1}>+ <h1 className="text-center text-3xl font-semibold">+ Your teams, your agents, all in the same room+ </h1>+ </Enter><ul className="grid w-full gap-8 sm:grid-cols-3">- <Point icon={<MessagesSquare className="size-5" />} title="In your chat app">+ <Point order={2} icon={<MessagesSquare className="size-5" />} title="In your chat app">Bring your agents from any provider to your messaging apps and start working together.</Point>- <Point icon={<Users className="size-5" />} title="Shared knowledge">+ <Point order={3} icon={<Users className="size-5" />} title="Shared knowledge">Chat history, instructions and documents available to every agent and person on theteam.</Point>- <Point icon={<ShieldCheck className="size-5" />} title="Security first">+ <Point order={4} icon={<ShieldCheck className="size-5" />} title="Security first">Built-in, customisable guardrails keep your data safe and your agents well-behaved.</Point></ul>- <UsageDataNotice />+ <Enter order={6}>+ <UsageDataNotice />+ </Enter></div></OnboardingSurface>);}-function Point({ icon, title, children }: { icon: ReactNode; title: string; children: ReactNode }) {+function Point({+ order,+ icon,+ title,+ children,+}: {+ order: number;+ icon: ReactNode;+ title: string;+ children: ReactNode;+}) {return (- <li className="flex list-none flex-col items-center gap-2 text-center">+ <Enter as="li" order={order} className="flex list-none flex-col items-center gap-2 text-center"><span className="text-foreground-muted">{icon}</span><span className="text-sm font-medium text-foreground">{title}</span><p className="text-sm text-foreground-muted">{children}</p>- </li>+ </Enter>);}diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-buddy/meet-buddy-page.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-buddy/meet-buddy-page.tsxindex d5310b5bd..14a258963 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-buddy/meet-buddy-page.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-buddy/meet-buddy-page.tsx@@ -156,6 +156,7 @@ export const MeetBuddyPage = observer(function MeetBuddyPage({if (settingUp)return (<OnboardingSurface+ key="setup"exit={exit}footer={<>@@ -175,7 +176,10 @@ export const MeetBuddyPage = observer(function MeetBuddyPage({return (<OnboardingSurface+ key="meet"exit={exit}+ // The opening scene stages its own entrance.+ enter={introPlayed.current}footer={existing ? (<Buttondiff --git a/console/apps/switch-console-desktop/src/renderer/lib/ui/wizard-frame.tsx b/console/apps/switch-console-desktop/src/renderer/lib/ui/wizard-frame.tsxindex 4de4dd108..f06352e47 100644--- a/console/apps/switch-console-desktop/src/renderer/lib/ui/wizard-frame.tsx+++ b/console/apps/switch-console-desktop/src/renderer/lib/ui/wizard-frame.tsx@@ -1,3 +1,4 @@+import { motion, useReducedMotion } from 'motion/react';import { createContext, useContext, type ReactNode } from 'react';import { Button } from './button';import { DialogContentArea, DialogFooter, DialogHeader, DialogTitle } from './dialog';@@ -122,15 +123,23 @@ export const ONBOARDING_BACKDROP =* numbered steps there, so the dialog's step pager is left out: Back is a* button on each page that has one.*/+/** How a first-run page's content arrives: a short rise and fade, the same spring as Meet switch-buddy's title. */+const PAGE_ENTER = { type: 'spring', stiffness: 260, damping: 26 } as const;+export function OnboardingSurface({exit,footer,+ enter = true,children,}: {exit: WizardExit | null;footer: ReactNode | null;+ /** Whether the content rises and fades in as the page opens; off for a page that stages its own entrance. */+ enter?: boolean;children: ReactNode;}) {+ const reduced = useReducedMotion() ?? false;+ const animated = enter && !reduced;return (<divclassName="relative flex h-full flex-col bg-background text-foreground [-webkit-app-region:drag]"@@ -144,14 +153,28 @@ export function OnboardingSurface({</div>)}<div className="flex min-h-0 flex-1 flex-col overflow-auto">- <div className="mx-auto flex w-full max-w-[760px] flex-1 flex-col justify-center gap-6 px-8 py-10 [-webkit-app-region:no-drag]">+ <motion.div+ initial={animated ? { opacity: 0, y: 14 } : false}+ animate={{ opacity: 1, y: 0 }}+ transition={{ ...PAGE_ENTER, opacity: { duration: 0.24, ease: 'easeOut' } }}+ className="mx-auto flex w-full max-w-[760px] flex-1 flex-col justify-center gap-6 px-8 py-10 [-webkit-app-region:no-drag]"+ >{children}- </div>+ </motion.div></div>{footer && (- <div className="flex justify-center gap-2 px-8 pt-2 pb-6 [-webkit-app-region:no-drag]">+ <motion.div+ initial={animated ? { opacity: 0, y: 10 } : false}+ animate={{ opacity: 1, y: 0 }}+ transition={{+ ...PAGE_ENTER,+ delay: 0.06,+ opacity: { duration: 0.24, ease: 'easeOut', delay: 0.06 },+ }}+ className="flex justify-center gap-2 px-8 pt-2 pb-6 [-webkit-app-region:no-drag]"+ >{footer}- </div>+ </motion.div>)}</div>);diff --git a/console/apps/switch-console-desktop/src/renderer/tests/browser/onboarding-flow.test.tsx b/console/apps/switch-console-desktop/src/renderer/tests/browser/onboarding-flow.test.tsxindex 822ccc6ef..4975a5767 100644--- a/console/apps/switch-console-desktop/src/renderer/tests/browser/onboarding-flow.test.tsx+++ b/console/apps/switch-console-desktop/src/renderer/tests/browser/onboarding-flow.test.tsx@@ -100,6 +100,10 @@ vi.mock('@renderer/features/settings/use-app-settings-key', () => ({}));import { OnboardingFlow } from '@renderer/features/onboarding/onboarding-flow';+vi.mock('@renderer/lib/hooks/useTheme', () => ({+ useTheme: () => ({ effectiveTheme: 'emlight' }),+}));+import { onboardingStore } from '@renderer/features/onboarding/onboarding-store';let container: HTMLDivElement | null = null;@@ -116,6 +120,8 @@ beforeEach(() => {connectToSwitchCloud.mockReset();servers.length = 0;onboardingStore.reset();+ // The intro has its own test; these start on Welcome, as after it.+ onboardingStore.introPlayed();Object.assign(localServer, {status: null,docker: { available: true },@@ -207,6 +213,16 @@ async function type(input: HTMLInputElement, value: string): Promise<void> {}describe('the first-run flow', () => {+ it('opens on the intro the first time, and Skip goes on to Welcome for good', async () => {+ onboardingStore.rehearse();+ const el = await renderFlow();+ expect(el.textContent).not.toContain('Get started');+ await act(async () => button(el, 'Skip').click());+ await vi.waitFor(() => expect(el.textContent).toContain('Get started'));+ expect(onboardingStore.introPending).toBe(false);+ expect(localStorage.getItem('onboarding.introPlayed')).not.toBeNull();+ });+it("checks this computer's providers as it opens, for switch-buddy at the end", async () => {precheckProviders.mockClear();await renderFlow();