Text Animations

Annotate

Hand-drawn marker notes on a paragraph. Underlines, circles, boxes, highlights, strike-throughs and brackets draw themselves around the words you mark, one after another, when the text first comes into view. If a mark wraps onto the next line, it draws on each line. The shaky strokes come from a seed, so the same seed always draws the same marks. When the layout changes, it measures the text again, so the marks stay on their words.

Install

# Annotate needs no npm packages

Then copy 2 files into your project:

  • components/registry/annotate/annotate.tsx
  • hooks/use-animation-loop.ts

Props

PropTypeDefaultDescription
colorstring (hex)"#a855f7"Ink for the pen marks: underline, circle, box, strike and bracket.
highlightColorstring (hex)"#c084fc"Marker color for highlights. It sits behind the text and lets it show through.
durationnumber700Time to draw one mark.
gapnumber250Pause between one mark ending and the next one starting.
strokeWidthnumber2Pen width.
roughnessnumber1How shaky the hand is. 0 draws clean lines.
paddingnumber5Space between the words and the mark.
seednumber7Picks the hand. The same seed always draws the same marks.
trigger"mount" | "inView""inView"When the marks start drawing: as soon as it mounts, or the first time it scrolls into view.

What It Demonstrates

Line drawing
An SVG path that draws itself in, like an invisible pen tracing it.
Stagger
Animate several items one after another with a small delay between each, creating a cascade.
Orchestration
Deliberately timing multiple animations so they feel like one coordinated motion.

Related Components

Appears In