Rendering Animations
Tegaki handles text layout, line wrapping, and animation playback. See the framework guides for framework-specific setup.
Basic usage
Section titled “Basic usage”Styling
Section titled “Styling”Tegaki reads its typography from the container’s own CSS. Set font-size,
line-height, color, and letter-spacing however you normally would (inline
style, a class, a CSS variable) and the renderer picks them up, re-measuring
when they change. letter-spacing is applied to the animated strokes just as
the browser would space static text, so spacing, line wrapping, and the drawn
glyphs stay in sync. line-height: normal gives the font’s own line spacing:
it differs from font to font (Tangerine sets lines 1em apart, Amiri 1.76em) and
is measured from the browser, so the strokes land where the text would. Most
pages inherit a fixed line-height (Tailwind’s base styles set 1.5), which is
loose for handwriting fonts with small letters; set normal or a smaller ratio
on the renderer to tighten it.
Time control modes
Section titled “Time control modes”Uncontrolled
Section titled “Uncontrolled”The component manages its own animation clock:
Options:
speed: playback speed multiplier (default1)loop: restart when animation completes (defaultfalse)playing: pause/resume (defaulttrue)catchUp: speed up when buffered text is ahead (for streaming)
Controlled
Section titled “Controlled”You provide the current time value directly (useful for syncing with external state):
Animation is driven purely by CSS (best performance, no JavaScript animation loop):
Effects
Section titled “Effects”All frameworks accept the same effects configuration:
Effects can also be set to true for defaults: { pressureWidth: true }.
Streaming text
Section titled “Streaming text”For chat-like interfaces where text arrives incrementally, see Streaming Text.