---
name: studio-motion-graphics
description: Build orbital, radial and data-driven motion graphics (loaders, hero loops, network diagrams) from angle-and-phase math in SVG, Canvas or Remotion, with seamless loops and web/video exports. Use for "orbit animation", "radial motion graphic", "animated logo loop", "looping hero graphic".
version: "1.1.0"
category: build
platforms: [CLAUDE_CODE, CURSOR, CODEX_CLI]
---

# Orbital motion graphics

Radial motion graphics stay clean when every element is a pure function of time: position from angle and radius, emphasis from a periodic curve, all sharing one loop phase. Accumulated offsets (`x += 2` per frame) drift and never loop. This skill covers the math, the build in SVG, Canvas, CSS or Remotion, and verified exports.

## When to use

- Orbiting markers around a logo or label, satellite or relay diagrams, radial loaders.
- Looping hero graphics for landing pages, product videos and social posts.
- Data-driven rings (each marker is an item) that must stay legible at small sizes.

## Agree on inputs first

| Input             | Default                                           |
| ----------------- | ------------------------------------------------- |
| Canvas and aspect | 1080x1080; 1920x1080; 1080x1920 vertical          |
| Loop period       | 4 to 8 s for ambient, 1 to 1.5 s for loaders      |
| fps               | 60 for web-realtime, 30 for video                 |
| Rings             | Radii, marker counts, direction per ring          |
| Palette           | Background, ring stroke, 1 accent, label color    |
| Delivery          | Live SVG/CSS/Canvas, MP4, WebM alpha, Lottie, GIF |
| Static fallback   | Which frame is the poster                         |

## Toolchain

- **Live web**: SVG + CSS (smallest, crisp, themeable) or Canvas 2D (many markers). Respect `prefers-reduced-motion`.
- **Video**: Remotion (React, frame-exact), or Node Canvas to PNG frames, then FFmpeg.
- **After Effects / Lottie**: when designers need to edit; export with Bodymovin and verify in `lottie-web`.
- **Three.js**: only when the orbit is genuinely 3D (tilted rings, depth sorting).

## The math

```ts
const TAU = Math.PI * 2;
// t in [0, 1): frame / durationInFrames  (never frame / (N - 1))
function marker(
  i: number,
  n: number,
  ring: { r: number; cycles: number; dir: 1 | -1 },
  t: number,
) {
  const base = (i / n) * TAU; // fixed relative spacing
  const a = base + ring.dir * ring.cycles * TAU * t; // integer cycles -> seamless
  return { x: cx + ring.r * Math.cos(a), y: cy + ring.r * Math.sin(a), a };
}
const pulse = (t: number, k = 1, phase = 0) =>
  0.5 - 0.5 * Math.cos(TAU * (k * t + phase)); // 0..1
```

Rules:

- `ring.cycles` and every pulse frequency `k` are integers per loop. Different rings can use different integers (1 and 2) for rhythm, or opposite `dir` for counter-rotation.
- Stagger emphasis with `phase = i / n`, so a highlight travels around the ring.
- Ellipses for fake 3D tilt: `y = cy + r * tilt * sin(a)` with `tilt` around 0.35, and scale or fade markers by `sin(a)` to imply depth. Draw back-half markers before the center label and front-half after it.
- Ease angular motion only with periodic easing. Linear rotation is fine for orbits; add life through pulse and opacity, not jerky angle easing.

## Workflow

### 1. Static frame first

Lay out center label, rings and markers at t = 0. Check at 25% size: labels legible, markers distinct (at least 1.5x marker diameter between centers), nothing touches the label's bounding box plus 8 px padding.

### 2. SVG + CSS (live web)

```html
<svg viewBox="0 0 400 400" role="img" aria-label="Relay network">
  <g class="ring" style="transform-origin:200px 200px">
    <circle
      cx="200"
      cy="200"
      r="140"
      fill="none"
      stroke="currentColor"
      stroke-opacity=".2"
    />
    <circle cx="340" cy="200" r="8" class="dot" />
    <circle cx="60" cy="200" r="8" class="dot" style="animation-delay:-3s" />
  </g>
  <text x="200" y="206" text-anchor="middle">Relay</text>
</svg>
<style>
  .ring {
    animation: spin 6s linear infinite;
  }
  .dot {
    transform-box: fill-box;
    transform-origin: center;
    animation: pulse 6s ease-in-out infinite;
  }
  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }
  @keyframes pulse {
    0%,
    100% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.35);
    }
  }
  @media (prefers-reduced-motion: reduce) {
    .ring,
    .dot {
      animation: none;
    }
  }
</style>
```

Negative `animation-delay` places elements at their phase immediately, with no startup jump. Animate only `transform` and `opacity` for compositor-only work.

### 3. Remotion (video)

```tsx
export const Orbit: React.FC = () => {
  const frame = useCurrentFrame();
  const { durationInFrames, width, height } = useVideoConfig();
  const t = frame / durationInFrames;
  // map markers with marker(i, n, ring, t); keep <Label/> outside the rotating group
};
```

```bash
npx remotion render src/index.ts Orbit out/orbit.mp4 --codec=h264 --crf=16
npx remotion render src/index.ts Orbit out/orbit.webm --codec=vp9 --image-format=png --pixel-format=yuva420p
npx remotion still src/index.ts Orbit out/poster.png --frame=0
```

### 4. Encode from frames (any renderer)

```bash
ffmpeg -framerate 60 -i f/%05d.png -c:v libx264 -crf 16 -preset slow -pix_fmt yuv420p \
  -movflags +faststart -an orbit.mp4
ffmpeg -framerate 60 -i f/%05d.png -c:v libvpx-vp9 -pix_fmt yuva420p -b:v 0 -crf 28 \
  -row-mt 1 -auto-alt-ref 0 orbit.webm
```

Thin strokes on dark backgrounds suffer from chroma subsampling; for crisp 1 to 2 px lines, render at 2x and downscale with `-vf scale=iw/2:-1:flags=lanczos`, or use `-crf 14`.

## Common variants

- **Loader**: 1 to 1.2 s period, a single ring with 8 to 12 dots and a traveling opacity pulse (`phase = i / n`). Must be meaningful within 300 ms.
- **Data ring**: marker count from data; if n exceeds about 24, switch to arcs or ticks, or the ring becomes noise.
- **Vertical 9:16**: center the system at 45% height; scale rings to 80% of width.
- **Lottie**: keep shapes vector, avoid expressions (unsupported in many players), and verify the file renders in `lottie-web` at the target size.
- **GIF**: `fps=30` from a 60 fps source divides frame counts cleanly; use palettegen/paletteuse.

## Quality checks

- **Loop seam**: render frame N (one past the end) as a still and diff against frame 0; they must be identical. With Remotion: render a temporary composition of duration N+1 and compare `--frame=N` to `--frame=0` using `magick compare -metric AE a.png b.png null:` (expect 0 or near 0).
- **Frame count**: `ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=nb_read_frames -of csv=p=0 orbit.mp4` equals period x fps.
- **Spacing**: at every 10th frame, compute the minimum center distance between markers and to the label box; assert above threshold in a script.
- **Thumbnail**: poster at 200 px wide still communicates the idea.
- **Motion safety**: no flashes over 3 per second, no large full-screen luminance swings; reduced-motion users get the static poster.
- **Performance (live)**: Chrome DevTools Performance shows no layout or paint per frame for SVG/CSS; Canvas stays under 4 ms per frame on a mid phone.

## Pitfalls and fixes

| Problem                             | Fix                                                              |
| ----------------------------------- | ---------------------------------------------------------------- |
| Markers slowly drift out of spacing | Position from absolute angle, never accumulate deltas            |
| Hitch once per loop                 | Non-integer cycle count, or the duplicate end frame was rendered |
| Label spins with the ring           | Label is inside the rotating group; move it out                  |
| SVG dots orbit the wrong center     | Missing `transform-box`/`transform-origin`; set them explicitly  |
| Stroke shimmer in video             | 4:2:0 subsampling on thin lines; render at 2x, lower CRF         |
| Jump at page load                   | Use negative `animation-delay` to start mid-phase                |

## Deliverables

- [ ] Source (SVG/CSS, Canvas or Remotion) with period, cycles and phases as named constants
- [ ] Poster PNG (frame 0) and reduced-motion behavior
- [ ] MP4 and alpha variants as requested
- [ ] Seam diff result and ffprobe frame count
- [ ] Note of minimum supported display size

[Phase Loom reference](https://skills-hub.ai/showcases/projects/phase-loom)
