Hero Sequences
A large illustrative hero SVG that animates the sequence-model motif (RNN / LSTM / GRU) as a "memory relay": three timestep cells on a horizontal track receive dropping tokens, hidden-state bars fill, the cell-state ribbon brightens across the cells, output arrows rise as h-one, h-two, and h-three, and connecting arrows pulse between cells to convey hidden-state passing through time. Theme-driven via currentColor + a single accentColor prop; reduced-motion users see a static end state.
Customize
Hero illustration
400px
accent
false
Installation
npx shadcn@latest add https://craftbits.dev/r/hero-sequences.jsonUsage
import { HeroSequences } from "@craft-bits/core/svg/hero-sequences";
<HeroSequences size={400} />
// Tint via the parent text color.
<div className="text-cb-accent">
<HeroSequences />
</div>Understanding the component
- Continuous storyboard. A single
useEffectschedules the full ~8s cycle: the horizontal track fades in, the three cell outlines stagger in left-to-right, the cell-state ribbon base appears, then tokens (x-one, x-two, x-three) drop into each cell in turn. After each token lands, the cell glow intensifies, the inner hidden-state bar fills to a higher target (0.4, then 0.65, then 0.9 of max), the corresponding ribbon segment brightens, and the output arrow rises. Connecting arrows between cells pulse as the signal passes. Everything fades, token positions reset, and the loop restarts. Every timer is cleaned up on unmount and when reduced-motion changes. - Motion values, not re-renders. Cell glow opacity, hidden-bar widths, ribbon-segment opacities, output-arrow positions, and token Y values are all driven by
motion'suseMotionValue+useSpring, so the React tree never re-renders during the loop. Springs come from@craft-bits/core/motion—SPRINGS.smoothfor cell entrances and most opacities,SPRINGS.bouncyfor dropping tokens,SPRINGS.snapfor output arrows,SPRINGS.slowfor the master fade. - Theme-driven color. Cell bodies, the track line, and the caption use
currentColor, so the host tints the structural chrome with anytext-cb-*utility. TheaccentColorprop colors the glow halo, ribbon segments, hidden-state bars, output arrows, connecting arrows, and dropping tokens — any CSS color (includingvar(--color-accent-500)). - Reduced-motion safe. When
prefers-reduced-motion: reduceis set, or thepausedprop istrue, the loop short-circuits to a single static end state: all three cells lit, ribbon fully bright, output arrows raised, connecting arrows visible.
Variants / Examples
// Paused — useful for thumbnails / OG images.
<HeroSequences paused />
// Compact thumbnail.
<HeroSequences size={200} />
// Explicit accent color.
<HeroSequences size={480} accentColor="var(--color-accent-300)" />
// Custom hex.
<HeroSequences accentColor="#8b5cf6" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
size | number | 400 | Pixel width. Height is computed from the 400×280 aspect ratio. |
accentColor | string | 'currentColor' | Any CSS color. Tints the glow, ribbon, hidden bars, output arrows, connecting arrows, and dropping tokens. |
paused | boolean | false | When true, render a single static end state instead of looping. |
className | string | — | Extra classes merged onto the root SVG. |
...rest | SVGAttributes<SVGSVGElement> | — | Other SVG props forwarded to the root. |
Accessibility
- The root SVG carries
aria-hidden="true"— the illustration is decorative; pair it with a visible heading or caption in its surrounding context. - Motion respects
prefers-reduced-motion: reduce: the loop short-circuits and renders a static end state. - All colors flow from
currentColor+ theaccentColorprop, so contrast tracks the consumer's text and accent tokens — no hardcoded hex values.
Credits
- Extracted from:
craftingattention(app/src/lessons/primitives/chrome/icons/heroes/HeroSequences.tsx). - Inspiration: classical recurrent-network diagrams (RNN / LSTM / GRU) — "memory through time".