# Particle Logo Animation

Motionboard shot name: Particle Sphere

On black, a sphere of fine blue and violet particles swirls and tightens, then condenses and flows in spirals into a four-point star mark. The particles cross-fade into a crisp vector mark, which slides left as the name Halcyon and a tagline arrive.

- Position in a launch film: Ending
- Slug: particle-logo-animation
- Preview video: https://media.motionboard.app/particle-sphere.mp4
- Recipe page: https://motionboard.app/recipes/particle-logo-animation/
- License: MIT. Free to use in your own projects, including commercial launch films. https://github.com/krisyangdev/motionboard/blob/main/LICENSE

## How to use this recipe

You are a coding agent. The user wants this shot for their own product. Follow these steps.

1. **Know the product.** If the product is clear from the user's repo or conversation, ask nothing and start. Otherwise ask once for: product name, logo file, brand colors.
2. **Pick the output.** If the user's message says a video or their website, do that. Otherwise ask once which one they want.
   - **Video (HyperFrames).** Create a folder named `particle-sphere`. Download every file under "Source files" below with the curl commands, keeping relative paths. Adapt `index.html` (see "What to adapt"). Run `npx --yes hyperframes@0.8.209 check` on the untouched copy first and note its result. Preview with `npx --yes hyperframes@0.8.209 preview`, render an MP4 with `npx --yes hyperframes@0.8.209 render` (into `renders/`, named with a timestamp). The same commands are in `package.json` as `dev`, `check`, `render`; pass flags after `--`, as in `npm run render -- --quality draft`. Rendering needs network access for web fonts and GSAP.
   - **Website motion.** Port the GSAP timeline in `index.html` into the user's site, using their stack (React, Vue, Svelte, plain HTML). Build the same DOM structure, keep the timeline's durations, delays and easings exactly, and start it when the element scrolls into view (IntersectionObserver or ScrollTrigger). Respect `prefers-reduced-motion: reduce`: show the final frame as a static state and skip the movement.
3. **What to adapt.**
   - **Brand layer** (product name, logo, colors, fonts, copy): replace directly with the user's.
   - **UI layer** (the product screens, cards, windows, controls shown in the shot): rebuild the user's real UI as clean DOM, from their codebase (components, design tokens) or from a screenshot used as reference only. Never paste a screenshot into the shot.
   - **Motion** (timing, easing, camera moves, layering, stagger, order of events): keep exactly as in the source. This is what the recipe is.
   - The timeline targets UI elements by id and class, and camera moves land on fixed coordinates. Keep the ids the timeline uses, keep row counts and text lengths close to the source, and when the layout moves, update the target coordinates without changing the times.
4. **Fonts.** HyperFrames fetches Google Fonts such as Inter on its own. Some sources use macOS local fonts (PingFang, Songti via `local()`). Use the user's brand font when it can be bundled; for a system font such as SF Pro, use Inter. Check that text still fits its boxes.
5. **Verify.** Compare the render with the preview video above at the beat times in the Timing row. The beats, timing and camera should match; only brand and UI content differ.

## Spec

| Item | Value |
| --- | --- |
| Timing | Film 11s. The scatter tightens into a clean sphere 0–3.5s; the sphere shrinks to 70% 3.5–4.9s; each particle leaves at 3.7–4.9s and travels for 1.25–1.5s, so the last one lands at 6.4s; core glow in 5.0–6.4s and out 7.2–8.1s; the crisp mark fades in 6.3–6.9s while the particle mark fades out 6.4–7.0s; the mark glides left 7.15–8.15s (1.0s); wordmark 8.0–8.7s; tagline 8.3–8.75s; lockup holds still from 8.75s to the end (2.25s) |
| Easing | Scatter `(1 − smoothstep)^1.2` over 0–3.5s; sphere shrink and rotation ramps smoothstep; particle flight power3.inOut; mark crossfade power1.inOut; mark move power3.inOut; wordmark expo.out; tagline power2.out; core glow power2.inOut |
| Camera | Locked frame on black with a fixed 3D view of the sphere: perspective 1500/(1500−z), yaw 0.2 × the rotation angle, tilt 0.42 rad, roll 0.22 rad. Rotation speed is 0.62 rad/s, plus up to 1.1 rad/s between 3.3 and 6.3s (peak 4.4–4.9s), then slows to 10% by 8.2s |
| Subject | 5,000 particles of 1.5–3px on a shell of radius 380px: latitude asin(1−2(i+0.5)/5000), longitude i × 2.399963 rad, 18 latitude bands at 0.3–1.2 times the rotation angle. Back-to-front brightness 0.28 to 1.0 and size follows the perspective scale; each particle is an opaque core plus a round glow of 2.3 times its size at 11% opacity. The mark is a four-point star (tips at 190px, quadratic sides through (±26, ±26)) crossing four ring arcs (radius 128px, 16px thick, 12°–78° per quadrant), scale 1.05; 4,750 particles take 80% star points and 20% ring points, sorted top to bottom. About 250 particles never join the mark: they drift out to 1.3–2.2 times the radius at 3.8–7.5s and fade to 50%. The vector mark is a 480px SVG box scaled 1.05, shrinking to 0.5 in the lockup; wordmark 150px and tagline 44px sit 48px to the right of the mark, the group centred on the frame |
| Sync | Flight starts while the sphere shrinks and spins faster (3.7s), so the pull inward and the flow are one gesture; the crisp mark starts fading in at 6.3s, while the last particles are still landing at 6.4s, so the shape never vanishes; the mark begins to move at 7.15s, after the particle mark is gone at 7.0s; the wordmark starts at 8.0s, 0.15s before the mark lands at 8.15s, with a 48px gap; the tagline finishes at 8.75s, the moment the lockup stops |
| Style | Background `#05060b`, accent gradient `#7fb0ff` to `#ad86ff` on the mark, particle palette `#688cff` `#8c6eff` `#aabeff` `#e1e8ff`; Inter 600 wordmark in `#f4f6ff`, tagline `#9aa4cf`; a faint 900px blue core glow; no grain and no additive blending |

## Why it works

A sphere of fine particles is read as one object while it spins, so when it condenses the viewer follows the whole mass moving toward the centre and sees the mark appear where the particles end up. Each latitude band turns at its own speed, which makes the sphere shear and swirl before anything else happens, and the 3D tilt with perspective makes front particles larger and brighter than back ones, so the sphere has depth with no lighting. The particles leave the sphere at staggered times and travel in clockwise spirals, so the flow reads as a vortex and the mark fills in gradually from the top down. The last step is a cross-fade from particles to a crisp vector mark in the same position and scale, which gives the film a solid logo to hold on; the glow and the particles stay opaque, so nothing blows out to white. The mark itself is a four-point star passing through gaps in a broken ring, and its centre is brighter than its tips. Only after the particle mark has faded does the mark slide left and the wordmark and tagline arrive, so the lockup never overlaps the previous scene. A few particles stay outside the mark and keep turning slowly, so the hold at the end is still but not dead.

## Prompt

> Build an 11-second, 1920x1080, 30 fps dark product film called Particle Sphere for a fictional product, Halcyon (an AI model). Background #05060b, accent gradient #7fb0ff to #ad86ff, font Inter. Draw everything on one 1920x1080 canvas 2D redrawn from timeline time: one linear proxy tween from 0 to 11 s whose onUpdate calls draw(tl.time()), plus one draw(0) at load. No requestAnimationFrame, Date or Math.random; use a seeded mulberry32 for every random value. Use 5,000 particles of 1.5–3 px, each with a fixed colour from a soft palette (#688cff, #8c6eff, #aabeff, #e1e8ff, #5aaaff, #be96ff), drawn as an opaque core plus a faint round glow (radius 2.3 times the core, 11% opacity), source-over only, never additive. Put particle i on a sphere of radius 380 px at latitude asin(1 − 2(i + 0.5)/5000) and longitude i × 2.399963 rad. Split the latitudes into 18 bands, each turning at its own speed between 0.3 and 1.2 times one shared rotation angle, so the bands slide against each other. Project in 3D: yaw 0.2 × the rotation angle, tilt 0.42 rad around X, roll 0.22 rad, perspective 1500/(1500 − z). Brightness runs from 0.28 at the back to 1.0 at the front and size follows the perspective scale. Integrate the rotation speed once into a table: 0.62 rad/s, plus up to 1.1 rad/s that ramps in over 3.3–4.4 s and out over 4.9–6.3 s, with the base slowing to 10% over 6.0–8.2 s. Beat 1 (0–3.5 s): offset every particle randomly in radius, latitude and longitude, with the offset shrinking as (1 − smoothstep(0, 3.5 s))^1.2, so a loose swirl tightens into a clean sphere; start each particle at 60% brightness and reach full over 1 s. Beat 2 (3.5–6.4 s): shrink the sphere to 70% over 3.5–4.9 s. Sample 4,750 mark targets: a four-point star with tips at 190 px on the axes and quadratic sides through control points (±26, ±26), plus four ring arcs of radius 128 px and 16 px thickness covering 12° to 78° in each quadrant, so each tip passes through a gap; 80% of the points fill the star, 20% the ring, all scaled 1.05. Sort the targets top to bottom and give them to the particles in latitude order. Each particle leaves at 3.7 s plus a random 0–1.2 s, freezes its sphere position at that moment and flies for 1.25–1.5 s with power3.inOut in polar coordinates around the frame centre: radius to the target radius, angle swept clockwise by 0 to 1.6π, so every particle spirals into place. Blend its colour to the mark gradient (white near the centre), flatten the depth to 0 and raise brightness to 0.92. About 250 particles never join: from 3.8 to 7.5 s they drift out to 1.3–2.2 times the radius, fade to 50% and keep turning slowly through the lockup. Add a 900 px soft blue radial glow behind the mark (opacity 0 to 1 over 5.0–6.4 s, back to 0 over 7.2–8.1 s). At 6.3–6.9 s fade in the crisp SVG mark, same position and scale (a 480 px box scaled 1.05: the star, the four ring arcs, a white radial core), over the particle mark, which fades out 6.4–7.0 s. Beat 3: from 7.15 s the mark moves 300 px left and 35 px up and scales to 0.5 in 1.0 s (power3.inOut); the wordmark Halcyon (Inter 600, 150 px, letter-spacing −0.03em, #f4f6ff) slides in 16 px over 0.7 s (expo.out) from 8.0 s, 48 px to the right of the mark, the pair centred on the frame; the tagline Thinks in every direction. (44 px, #9aa4cf) rises 12 px and fades in over 0.45 s from 8.3 s. The lockup is settled at 8.75 s and holds still to 11 s.

## Often confused with

- [Converging Logo Reveal](https://motionboard.app/r/converge-logo-reveal.md): Converge Logo Reveal gathers a few interface pieces into an icon; this film flows 5,000 particles from a rotating 3D sphere into the mark and cross-fades to a vector logo.
- [Dot Matrix Animation](https://motionboard.app/r/dot-matrix-animation.md): Dot Matrix Animation snaps a graphic onto a fixed dot grid; here the particles move freely in 3D, then spiral into the shape of a mark.

## Source files

Runnable HyperFrames project, 3 files.

- https://motionboard.app/source/particle-sphere/hyperframes.json (318 B)
- https://motionboard.app/source/particle-sphere/index.html (14.4 KB)
- https://motionboard.app/source/particle-sphere/package.json (304 B)

Download all of them:

```sh
curl -fsSL --create-dirs -o "particle-sphere/hyperframes.json" "https://motionboard.app/source/particle-sphere/hyperframes.json"
curl -fsSL --create-dirs -o "particle-sphere/index.html" "https://motionboard.app/source/particle-sphere/index.html"
curl -fsSL --create-dirs -o "particle-sphere/package.json" "https://motionboard.app/source/particle-sphere/package.json"
```

## index.html

```html
<!doctype html>
<html lang="en" data-resolution="landscape">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=1920, height=1080" />
    <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
    <style>
      :root {
        --ink: #f4f6ff;
        --mute: #9aa4cf;
        --font-ui: "Inter", sans-serif;
      }
      * { margin: 0; padding: 0; box-sizing: border-box; }
      html, body { width: 1920px; height: 1080px; overflow: hidden; background: #05060b; }
      #root {
        position: relative; width: 1920px; height: 1080px; overflow: hidden; background: #05060b;
        font-family: var(--font-ui); color: var(--ink); -webkit-font-smoothing: antialiased;
      }
      .full { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; }

      #bg { z-index: 0; background: #05060b; }
      #core { z-index: 1; }
      #coreg {
        position: absolute; left: 510px; top: 90px; width: 900px; height: 900px; border-radius: 50%; opacity: 0;
        background: radial-gradient(circle, rgba(96, 130, 255, 0.3) 0%, rgba(120, 110, 255, 0.12) 40%, rgba(96, 130, 255, 0) 68%);
      }
      #pcv { z-index: 2; }
      #pcv canvas { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; display: block; }
      #mk { z-index: 3; }
      #markW { position: absolute; left: 720px; top: 300px; width: 480px; height: 480px; opacity: 0; }
      #markW svg { display: block; }
      #lockup { z-index: 4; }
      #wm {
        position: absolute; left: 793px; top: 430px; width: 560px; height: 150px; font-size: 150px; line-height: 150px; font-weight: 600;
        letter-spacing: -0.03em; color: var(--ink); white-space: nowrap; opacity: 0;
      }
      #tag {
        position: absolute; left: 0; top: 612px; width: 1920px; text-align: center; font-size: 44px; line-height: 56px; font-weight: 400;
        letter-spacing: -0.005em; color: var(--mute); opacity: 0;
      }
    </style>
  </head>
  <body>
    <div id="root" data-composition-id="main" data-start="0" data-duration="11" data-width="1920" data-height="1080">
      <div id="bg" class="clip full" data-start="0" data-duration="11" data-track-index="0"></div>

      <div id="core" class="clip full" data-start="0" data-duration="11" data-track-index="1" data-layout-allow-overlap data-layout-ignore>
        <div id="coreg"></div>
      </div>

      <div id="pcv" class="clip full" data-start="0" data-duration="11" data-track-index="2" data-layout-allow-overlap data-layout-ignore>
        <canvas id="cv" width="1920" height="1080"></canvas>
      </div>

      <div id="mk" class="clip full" data-start="0" data-duration="11" data-track-index="3" data-layout-allow-overlap data-layout-ignore>
        <div id="markW">
          <svg width="480" height="480" viewBox="-240 -240 480 480" xmlns="http://www.w3.org/2000/svg">
            <defs>
              <linearGradient id="mg" gradientUnits="userSpaceOnUse" x1="-190" y1="-190" x2="190" y2="190">
                <stop offset="0" stop-color="#7fb0ff" />
                <stop offset="1" stop-color="#ad86ff" />
              </linearGradient>
              <radialGradient id="mc" gradientUnits="userSpaceOnUse" cx="0" cy="0" r="80">
                <stop offset="0" stop-color="#ffffff" stop-opacity="0.95" />
                <stop offset="1" stop-color="#ffffff" stop-opacity="0" />
              </radialGradient>
            </defs>
            <g fill="none" stroke="url(#mg)" stroke-width="16">
              <path d="M125.2,26.6 A128 128 0 0 1 26.6,125.2" />
              <path d="M-26.6,125.2 A128 128 0 0 1 -125.2,26.6" />
              <path d="M-125.2,-26.6 A128 128 0 0 1 -26.6,-125.2" />
              <path d="M26.6,-125.2 A128 128 0 0 1 125.2,-26.6" />
            </g>
            <path d="M0,-190 Q26,-26 190,0 Q26,26 0,190 Q-26,26 -190,0 Q-26,-26 0,-190Z" fill="url(#mg)" />
            <path d="M0,-190 Q26,-26 190,0 Q26,26 0,190 Q-26,26 -190,0 Q-26,-26 0,-190Z" fill="url(#mc)" />
          </svg>
        </div>
      </div>

      <div id="lockup" class="clip full" data-start="0" data-duration="11" data-track-index="4" data-layout-allow-overlap data-layout-ignore>
        <div id="wm">Halcyon</div>
        <div id="tag">Thinks in every direction.</div>
      </div>
    </div>

    <script>
      /* ---------- seeded random ---------- */
      function mb(a) {
        return function () {
          a |= 0; a = (a + 0x6d2b79f5) | 0;
          let t = Math.imul(a ^ (a >>> 15), 1 | a);
          t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
          return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
        };
      }
      const rnd = mb(94);
      const cl = (x, a, b) => Math.min(b === undefined ? 1 : b, Math.max(a === undefined ? 0 : a, x));
      const sstep = (a, b, t) => { const u = cl((t - a) / (b - a)); return u * u * (3 - 2 * u); };
      const e3 = (u) => (u < 0.5 ? 4 * u * u * u : 1 - Math.pow(-2 * u + 2, 3) / 2);
      const PI = Math.PI, TAU = Math.PI * 2;

      /* ---------- constants ---------- */
      const W = 1920, H = 1080, CX = 960, CY = 540;
      const N = 5000, R = 380, F = 1500;
      const MS = 1.05; // mark scale in the canvas, matches #markW scale

      /* ---------- mark geometry (Halcyon: four-point star through a broken ring) ---------- */
      const TIPS = [[0, -190], [190, 0], [0, 190], [-190, 0]];
      const CTRL = [[26, -26], [26, 26], [-26, 26], [-26, -26]];
      const poly = [];
      for (let q = 0; q < 4; q++) {
        const p0 = TIPS[q], c = CTRL[q], p1 = TIPS[(q + 1) % 4];
        for (let s = 0; s < 24; s++) {
          const u = s / 24, v = 1 - u;
          poly.push([v * v * p0[0] + 2 * u * v * c[0] + u * u * p1[0], v * v * p0[1] + 2 * u * v * c[1] + u * u * p1[1]]);
        }
      }
      function inPoly(x, y) {
        let ins = false;
        for (let i = 0, j = poly.length - 1; i < poly.length; j = i++) {
          const xi = poly[i][0], yi = poly[i][1], xj = poly[j][0], yj = poly[j][1];
          if (yi > y !== yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) ins = !ins;
        }
        return ins;
      }

      /* ---------- particles ---------- */
      const PAL = [[104, 140, 255], [140, 110, 255], [170, 190, 255], [225, 232, 255], [90, 170, 255], [190, 150, 255], [225, 232, 255], [120, 150, 255]];
      const BW = []; for (let b = 0; b < 18; b++) BW.push(0.3 + rnd() * 0.9);

      const lat = new Float32Array(N), lon0 = new Float32Array(N), j1 = new Float32Array(N), j2 = new Float32Array(N), j3 = new Float32Array(N);
      const om = new Float32Array(N), sz = new Float32Array(N), pr = new Float32Array(N), pg = new Float32Array(N), pb = new Float32Array(N);
      const stray = new Uint8Array(N), sk = new Float32Array(N), ts = new Float32Array(N), du = new Float32Array(N), hin = new Float32Array(N);
      const tx = new Float32Array(N), ty = new Float32Array(N), trho = new Float32Array(N), tang = new Float32Array(N);
      const tr = new Float32Array(N), tg = new Float32Array(N), tb = new Float32Array(N);

      let nMark = 0;
      for (let i = 0; i < N; i++) {
        lat[i] = Math.asin(1 - (2 * (i + 0.5)) / N);
        lon0[i] = (i * 2.399963) % TAU;
        j1[i] = rnd() * rnd() * 2.2 - 0.2;
        j2[i] = (rnd() - 0.5) * 2;
        j3[i] = (rnd() - 0.5) * 2;
        const band = Math.min(17, Math.floor(((lat[i] + PI / 2) / PI) * 18));
        om[i] = BW[band];
        sz[i] = 1.5 + rnd() * 1.5;
        const c = PAL[Math.floor(rnd() * PAL.length)];
        pr[i] = c[0]; pg[i] = c[1]; pb[i] = c[2];
        stray[i] = rnd() < 0.05 ? 1 : 0;
        sk[i] = 0.3 + rnd() * 0.9;
        hin[i] = rnd() * 0.8;
        ts[i] = 3.7 + (0.7 * rnd() + 0.3 * (i / N)) * 1.2;
        du[i] = 1.25 + rnd() * 0.25;
        if (!stray[i]) nMark++;
      }

      // mark targets, sorted top to bottom so the sphere's upper latitudes pour into the upper mark
      const nRing = Math.round(nMark * 0.2), nStar = nMark - nRing;
      const targets = [];
      for (let n = 0; n < nRing; n++) {
        const k = Math.floor(rnd() * 4), a = k * (PI / 2) + (12 * PI) / 180 + rnd() * ((66 * PI) / 180), r = 128 + (rnd() - 0.5) * 16;
        targets.push([r * Math.cos(a), r * Math.sin(a)]);
      }
      while (targets.length < nMark) {
        const x = (rnd() * 2 - 1) * 190, y = (rnd() * 2 - 1) * 190;
        if (inPoly(x, y)) targets.push([x, y]);
      }
      targets.sort((a, b) => a[1] - b[1]);
      {
        let m = 0;
        for (let i = 0; i < N; i++) {
          if (stray[i]) continue;
          const x = targets[m][0], y = targets[m][1]; m++;
          tx[i] = x * MS; ty[i] = y * MS;
          trho[i] = Math.hypot(tx[i], ty[i]); tang[i] = Math.atan2(ty[i], tx[i]);
          const u = cl((x + y) / 380 + 0.5), w = Math.pow(cl(1 - Math.hypot(x, y) / 110), 2);
          let r = 127 + (173 - 127) * u, g = 176 + (134 - 176) * u, b = 255;
          r += (238 - r) * w; g += (240 - g) * w; b += (255 - b) * w;
          tr[i] = r; tg[i] = g; tb[i] = b;
        }
      }

      /* ---------- rotation speed table (integrated once, deterministic) ---------- */
      const speed = (t) => 0.62 * (1 - 0.9 * sstep(6.0, 8.2, t)) + 1.1 * sstep(3.3, 4.4, t) * (1 - sstep(4.9, 6.3, t));
      const TH = new Float64Array(1400);
      { let acc = 0; for (let k = 1; k < 1400; k++) { acc += speed((k - 0.5) / 120) / 120; TH[k] = acc; } }
      const thetaAt = (t) => { const f = Math.max(0, t) * 120, k = Math.min(1398, Math.floor(f)); return TH[k] + (TH[k + 1] - TH[k]) * (f - k); };

      /* ---------- sphere position of particle i at time t ---------- */
      const o = { x: 0, y: 0, z: 0, k: 1 }, oa = { x: 0, y: 0, z: 0, k: 1 };
      const TILT = 0.42, CT = Math.cos(TILT), ST = Math.sin(TILT), ROLL = 0.22, CR = Math.cos(ROLL), SR = Math.sin(ROLL);
      function sph(i, t, out) {
        const th = thetaAt(t), s = Math.pow(1 - sstep(0, 3.5, t), 1.2), sh = sstep(3.5, 4.9, t);
        const phi = lat[i] + s * j2[i] * 0.6, lam = lon0[i] + om[i] * th + s * j3[i] * 1.6;
        let rr = R * (1 + s * j1[i]) * (1 - 0.3 * sh);
        if (stray[i]) rr *= 1 + sstep(3.8, 7.5, t) * sk[i];
        const cp = Math.cos(phi);
        const x = rr * cp * Math.cos(lam), y = -rr * Math.sin(phi), z = rr * cp * Math.sin(lam);
        const yw = 0.2 * th, cy = Math.cos(yw), sy = Math.sin(yw);
        const x1 = x * cy + z * sy, z1 = -x * sy + z * cy;
        const y2 = y * CT - z1 * ST, z2 = y * ST + z1 * CT;
        const x3 = x1 * CR - y2 * SR, y3 = x1 * SR + y2 * CR;
        const k = F / (F - z2);
        out.x = CX + x3 * k; out.y = CY + y3 * k; out.z = z2; out.k = k;
      }

      /* ---------- canvas draw ---------- */
      const cv = document.getElementById("cv"), ctx = cv.getContext("2d");
      const X = new Float32Array(N), Y = new Float32Array(N), Z = new Float32Array(N), S = new Float32Array(N), A = new Float32Array(N);
      const CRr = new Float32Array(N), CGg = new Float32Array(N), CBb = new Float32Array(N), FL = new Float32Array(N);

      function draw(t) {
        ctx.clearRect(0, 0, W, H);
        const mfade = 1 - sstep(6.4, 7.0, t);
        const sa = 1 - 0.5 * sstep(4, 6, t);
        for (let i = 0; i < N; i++) {
          const ain = 0.6 + 0.4 * sstep(hin[i], hin[i] + 1.0, t);
          let x, y, z, k, a, r = pr[i], g = pg[i], b = pb[i], e = 0;
          const u = stray[i] ? 0 : (t - ts[i]) / du[i];
          if (u > 0) {
            e = e3(Math.min(1, u));
            sph(i, ts[i], oa);
            const ax = oa.x - CX, ay = oa.y - CY, rhoA = Math.hypot(ax, ay), angA = Math.atan2(ay, ax);
            let d = tang[i] - angA;
            d = ((((d + 0.4 * PI) % TAU) + TAU) % TAU) - 0.4 * PI;
            const ang = angA + d * e, rho = rhoA + (trho[i] - rhoA) * e;
            x = CX + rho * Math.cos(ang); y = CY + rho * Math.sin(ang);
            z = oa.z * (1 - e); k = F / (F - z);
            const aA = 0.28 + 0.72 * cl((oa.z + R) / (2 * R));
            a = aA + (0.92 - aA) * e;
            r += (tr[i] - r) * e; g += (tg[i] - g) * e; b += (tb[i] - b) * e;
            if (e >= 1) { x += 0.7 * Math.sin(t * 2.1 + i * 1.7); y += 0.7 * Math.cos(t * 1.9 + i * 2.3); }
            a *= mfade;
          } else {
            sph(i, t, o);
            x = o.x; y = o.y; z = o.z; k = o.k;
            a = 0.28 + 0.72 * cl((z + R) / (2 * R));
            if (stray[i]) a *= sa;
          }
          X[i] = x; Y[i] = y; Z[i] = z; S[i] = sz[i] * Math.min(k, 1.6) * (0.85 + 0.3 * cl((z + R) / (2 * R)) * (1 - e));
          A[i] = a * ain; CRr[i] = r; CGg[i] = g; CBb[i] = b; FL[i] = 1 - 0.5 * e;
        }
        for (let pass = 0; pass < 2; pass++) {
          // glow
          for (let i = 0; i < N; i++) {
            if ((Z[i] > 0 ? 1 : 0) !== pass || A[i] < 0.02) continue;
            ctx.fillStyle = "rgba(" + (CRr[i] | 0) + "," + (CGg[i] | 0) + "," + (CBb[i] | 0) + "," + (A[i] * 0.11 * FL[i]).toFixed(3) + ")";
            ctx.beginPath(); ctx.arc(X[i], Y[i], S[i] * 2.3, 0, TAU); ctx.fill();
          }
          // core
          for (let i = 0; i < N; i++) {
            if ((Z[i] > 0 ? 1 : 0) !== pass || A[i] < 0.02) continue;
            ctx.fillStyle = "rgba(" + (CRr[i] | 0) + "," + (CGg[i] | 0) + "," + (CBb[i] | 0) + "," + A[i].toFixed(3) + ")";
            ctx.beginPath(); ctx.arc(X[i], Y[i], S[i] * 0.5, 0, TAU); ctx.fill();
          }
        }
      }

      /* ---------- baselines (hidden states live in CSS; transforms set here once) ---------- */
      gsap.set("#markW", { scale: MS, transformOrigin: "50% 50%" });
      gsap.set("#wm", { x: -16 });
      gsap.set("#tag", { y: 12 });
      draw(0);

      /* ---------- timeline ---------- */
      const DUR = 11;
      const tl = gsap.timeline({ paused: true });

      // canvas is redrawn from timeline time
      tl.to({ v: 0 }, { v: 1, duration: DUR, ease: "none", onUpdate: () => draw(tl.time()) }, 0);

      // soft core light while the mark forms
      tl.to("#coreg", { opacity: 1, duration: 1.4, ease: "power2.inOut" }, 5.0);
      tl.to("#coreg", { opacity: 0, duration: 0.9, ease: "power2.inOut" }, 7.2);

      // particle mark resolves into the crisp vector mark
      tl.to("#markW", { opacity: 1, duration: 0.6, ease: "power1.inOut" }, 6.3);

      // lockup: mark glides left and shrinks, wordmark and tagline arrive
      tl.to("#markW", { x: -300, y: -35, scale: 0.5, duration: 1.0, ease: "power3.inOut" }, 7.15);
      tl.to("#wm", { opacity: 1, x: 0, duration: 0.7, ease: "expo.out" }, 8.0);
      tl.to("#tag", { opacity: 1, y: 0, duration: 0.45, ease: "power2.out" }, 8.3);

      tl.set({}, {}, DUR);

      window.__timelines = window.__timelines || {};
      window.__timelines["main"] = tl;
    </script>
  </body>
</html>
```
