PlaygroundThe Void
Move your pointer, tap the text, or focus the canvas and use the arrow keys. Press Escape to reset the opening.
Layout calculation: 0msLines: 0Observed frames/s: 0Rendering: Canvas
Balanced Text
A binary search finds a narrower text width without adding lines. Compare the resulting line widths below.
Computing balanced layout...
How It Works
The demo prepares text with @chenglou/pretext when it loads. On each animation frame, it calculates the available width beside the circular opening, lays out each line, and draws the text on canvas.
The statistics report the line-layout calculation and observed frame rate. Layout timing excludes drawing; results vary by browser and device. Width comparisons use a 500px reference layout; their text previews wrap to fit smaller screens.