Skip to content

Rendering Animations

Tegaki handles text layout, line wrapping, and animation playback. See the framework guides for framework-specific setup.

import { TegakiRenderer } from 'tegaki';
import bundle from 'tegaki/fonts/caveat';

<TegakiRenderer
  font={bundle}
  time={{ mode: 'uncontrolled', speed: 1, loop: true }}
  style={{ fontSize: 48 }}
>
  Hello World
</TegakiRenderer>

The component manages its own animation clock:

time: { mode: 'uncontrolled', speed: 2, loop: true }

Options:

  • speed — playback speed multiplier (default 1)
  • loop — restart when animation completes (default false)
  • playing — pause/resume (default true)
  • catchUp — speed up when buffered text is ahead (for streaming)

You provide the current time value directly (useful for syncing with external state):

time: 2.5 // seconds
// or
time: { mode: 'controlled', value: 2.5 }

Animation is driven purely by CSS (best performance, no JavaScript animation loop):

time: 'css'
// or
time: { mode: 'css' }

All frameworks accept the same effects configuration:

effects: {
  glow: { radius: 8, color: '#00ccff' },
  wobble: { amplitude: 1.5, frequency: 8 },
  pressureWidth: { strength: 1 },
  taper: { startLength: 0.15, endLength: 0.15 },
  gradient: { colors: 'rainbow' },
}

Effects can also be set to true for defaults: { pressureWidth: true }.

For chat-like interfaces where text arrives incrementally, see Streaming Text.