Liking cljdoc? Tell your friends :D

<x-kinetic-typography>

Animated typography that renders text along SVG paths with motion, visual effects, and dynamic sizing. Makes text feel alive with scrolling, bouncing, oscillating movement and combinable effects like opacity waves, per-character color waves, echo trails, and a Star Wars crawl mode.

Tag

<x-kinetic-typography text="Hello World" preset="wave" animation="scroll"></x-kinetic-typography>

Attributes

AttributeTypeDefaultDescription
textstring""Text to render along the path.
pathstringCustom SVG path d string. Overrides preset when present.
presetstring"wave"Named path shape: wave, circle, arc, infinity, spiral, sine, line, crawl.
animationstring"scroll"Path animation: none, scroll, bounce, oscillate.
speedstring"1"Speed multiplier. "2" = twice as fast, "0.5" = half speed.
directionstring"normal"Animation direction: normal, reverse.
effectstring"none"Space-separated visual effects (see Effects section).
font-sizestringBase font size override (CSS value, e.g. "32px", "2rem").
start-sizestringFont size at path start for size-gradient effect.
end-sizestringFont size at path end for size-gradient effect.
repeatstring"1"Times to repeat text along the path.
echo-countstring"0"Number of echo/trail copies (0-5).
echo-delaystring"0.3"Delay in seconds between each echo.
echo-opacitystring"0.5"Opacity multiplier per echo. Echo i gets opacity^(i+1).
echo-scalestring"0.85"Font-size multiplier per echo. Echo i gets scale^(i+1).

Path Presets

PresetDescription
waveSmooth horizontal sine wave (default).
circleFull circle path.
arcHalf-circle arch.
infinityFigure-eight / lemniscate.
spiral1.5-turn Archimedean spiral.
sineMulti-period sine wave.
lineStraight horizontal line.
crawlStar Wars opening crawl (CSS 3D perspective, not SVG).

Properties (JS API)

PropertyTypeReflects Attribute
textstringtext
pathstringpath
presetstringpreset
animationstringanimation
speedstringspeed
directionstringdirection
effectstringeffect
fontSizestringfont-size
startSizestringstart-size
endSizestringend-size
repeatstringrepeat
echoCountstringecho-count
echoDelaystringecho-delay
echoOpacitystringecho-opacity
echoScalestringecho-scale

CSS Custom Properties

PropertyDefaultDescription
--x-kinetic-typography-colorcurrentColorText fill color.
--x-kinetic-typography-font-familysystem-ui, sans-serifFont family.
--x-kinetic-typography-font-size24pxDefault font size.
--x-kinetic-typography-font-weight400Font weight.
--x-kinetic-typography-letter-spacing0Base letter spacing.
--x-kinetic-typography-opacity1Text opacity.
--x-kinetic-typography-strokenoneText stroke color.
--x-kinetic-typography-stroke-width0Text stroke width.
--x-kinetic-typography-duration10sBase animation cycle duration.
--x-kinetic-typography-timinglinearAnimation timing function.
--x-kinetic-typography-color-shift-fromcurrentColorColor shift/wave start color.
--x-kinetic-typography-color-shift-to#3b82f6Color shift/wave end color.
--x-kinetic-typography-path-strokenoneDecorative path line stroke.
--x-kinetic-typography-path-stroke-width0Decorative path line width.
--x-kinetic-typography-crawl-perspective400px3D perspective depth for crawl mode.

CSS Parts

PartDescription
containerOuter wrapper div.
svgThe SVG element (hidden in crawl mode).
textThe SVG <text> element.
text-echoEcho SVG <text> elements.
path-lineDecorative visible path line.
sr-onlyScreen-reader-only text span.
crawl-viewportCrawl mode perspective container (hidden in path mode).
crawl-textCrawl mode text div.

Visual Effects

Effects can be combined by space-separating tokens in the effect attribute.

EffectAnimatesDescription
opacity-waveopacityFades text in and out.
size-pulsefont-sizeGently pulses text size.
spacing-breatheletter-spacingExpands and contracts letter spacing.
color-shiftfillTransitions entire text between two colors.
color-waveper-character fillRipples color across individual characters with staggered delays. Uses the same color-shift-from/color-shift-to custom properties.
size-gradientper-characterApplies a font-size gradient from start-size to end-size. Auto-enabled when both size attributes are set.

Mutual exclusions:

  • size-gradient and size-pulsesize-gradient wins.
  • color-wave and color-shiftcolor-wave wins (it's a superset).

Echo / Trail Effect

Add trailing copies of the text that follow the main animation with progressive fading and shrinking.

<x-kinetic-typography
  text="Trailing echoes"
  preset="wave"
  animation="scroll"
  echo-count="3"
  echo-delay="0.3"
  echo-opacity="0.5"
  echo-scale="0.85">
</x-kinetic-typography>

With 3 echoes at default settings:

  • Echo 1: opacity 0.5, scale 0.85
  • Echo 2: opacity 0.25, scale 0.72
  • Echo 3: opacity 0.125, scale 0.61

Echoes are SVG-only and are disabled in crawl mode.

Star Wars Crawl (preset="crawl")

Switches from SVG text-on-path to CSS 3D perspective rendering. Text scrolls vertically upward with a receding-into-distance effect.

<x-kinetic-typography
  preset="crawl"
  animation="scroll"
  speed="0.3"
  text="A long time ago in a galaxy far, far away..."
  style="height:300px;
         --x-kinetic-typography-font-family:'Georgia',serif;
         --x-kinetic-typography-color:#fbbf24;
         --x-kinetic-typography-duration:30s;">
</x-kinetic-typography>

What works in crawl mode: text, animation (scroll/none), speed, direction, color-shift effect, font styling custom properties.

What doesn't apply: path, repeat, echo attributes, SVG-specific effects (size-gradient, size-pulse, spacing-breathe, opacity-wave, color-wave).

Accessibility

  • The SVG is aria-hidden="true".
  • A visually-hidden <span> contains the plain text for screen readers.
  • The host has role="img" and aria-label set to the text content.
  • When text is empty, the element has role="presentation" and aria-hidden="true".
  • All animations respect prefers-reduced-motion: reduce.

Usage

HTML

<!-- Basic scrolling text on a wave -->
<x-kinetic-typography
  text="Hello World"
  preset="wave"
  animation="scroll">
</x-kinetic-typography>

<!-- Per-character color wave -->
<x-kinetic-typography
  text="Rainbow ripple"
  preset="wave"
  animation="scroll"
  effect="color-wave"
  style="--x-kinetic-typography-color-shift-from:#6366f1;
         --x-kinetic-typography-color-shift-to:#ec4899;">
</x-kinetic-typography>

<!-- Text with echo trail -->
<x-kinetic-typography
  text="Echo trail"
  preset="wave"
  animation="scroll"
  echo-count="3"
  echo-delay="0.3">
</x-kinetic-typography>

<!-- Star Wars crawl -->
<x-kinetic-typography
  preset="crawl"
  animation="scroll"
  speed="0.3"
  text="It is a period of civil war..."
  style="height:300px;--x-kinetic-typography-color:#fbbf24;">
</x-kinetic-typography>

JavaScript

const el = document.createElement('x-kinetic-typography');
el.text = 'Dynamic Text';
el.preset = 'infinity';
el.animation = 'scroll';
el.speed = '1.5';
el.effect = 'color-wave';
el.echoCount = '2';
document.body.appendChild(el);

Theming

x-kinetic-typography {
  --x-kinetic-typography-color: #6366f1;
  --x-kinetic-typography-font-family: 'Georgia', serif;
  --x-kinetic-typography-font-size: 32px;
  --x-kinetic-typography-font-weight: 700;
  --x-kinetic-typography-duration: 15s;
  --x-kinetic-typography-color-shift-from: #6366f1;
  --x-kinetic-typography-color-shift-to: #ec4899;
  --x-kinetic-typography-path-stroke: rgba(0,0,0,0.1);
  --x-kinetic-typography-path-stroke-width: 1;
}

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close