Glyph loopDesign system
VisualProduct

Glyph loop

Looping product glyph animation that runs while visible.

npx context-ds add glyph-loop
In the product

Usage

Use it for

A glyph that keeps playing in a card or tile. Reduced motion keeps the subject.

Avoid

  • Loops on keyboard-driven UI
  • Many loops in step

Dependencies: dot-engine, glyph-engine

Example

examples/glyph-loop.tsx
import { GlyphLoop } from "@/components/visuals/glyph/glyph-loop";export function Product() {  return (    <div className="flex items-center justify-center gap-6">      <GlyphLoop name="monitors" className="w-16 text-brand" />      <GlyphLoop name="usage" startsAtSeconds={1.2} className="w-16 text-brand" />      <GlyphLoop name="team" startsAtSeconds={2.4} className="w-16 text-brand" />    </div>  );}

Source

components/visuals/glyph/glyph-loop.tsx
"use client";import { useCallback, useMemo } from "react";import { DotStory, type LoadDotStory } from "@/components/visuals/dot-engine/dot-story";import { GLYPH_GRID, glyphSubject, type GlyphPairName } from "@/components/visuals/glyph/glyph-art";type GlyphLoopProps = {  name: GlyphPairName;  /** The color repainted around the dots; defaults to the surface token. */  surfaceColor?: string;  /** How far into the subject's hold this loop starts, so neighbors don't change in step. */  startsAtSeconds?: number;  className?: string;};/** * A page's picture in the brand dot grid: its subject sweeps into what it gives you and back, while on screen. * Reduced motion keeps the subject. */export function GlyphLoop({ name, surfaceColor, startsAtSeconds = 0, className }: GlyphLoopProps) {  const resting = useMemo(() => ({ cells: glyphSubject(name) }), [name]);  const load = useCallback<LoadDotStory>(    async (stage) => {      const { createGlyphLoopPlayer } = await import("@/components/visuals/glyph/glyph-loop-player");      return createGlyphLoopPlayer(stage, name, startsAtSeconds);    },    [name, startsAtSeconds],  );  return <DotStory grid={GLYPH_GRID} resting={resting} load={load} surfaceColor={surfaceColor} className={className} />;}

Reference: context-dashboard c0ddf7a src/components/dots/glyph-loop.tsx.