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):
Pressure
Section titled “Pressure”The bundles record how wide the pen draws at each point. pressure (0 to 1, default 1) sets how much of that the ink follows: 0 draws each stroke at one even width.
Plugins
Section titled “Plugins”Glows, tapered ends, gradients and a hand that varies each letter are plugins, and all frameworks take them the same way, as a plugins list. They run in the order listed.
Each factory takes its options (or none, for the defaults). Where a plugin object can’t go (an HTML attribute, an Astro prop, a CLI flag), register the factories and name them instead:
See Style plugins for every option, Naming plugins for the registry, and Plugins for writing your own. The Studio’s Plugins tab tries them out live, along with demo plugins whose source you can copy into your project.
These used to be the effects option, which is gone: see Migrating from effects.
Streaming text
Section titled “Streaming text”For chat-like interfaces where text arrives incrementally, see Streaming Text.