pretext

Measure and lay out multiline text on HTML5 Canvas without DOM reflow.

Updated May 4, 2026
One-click install
npx skills add https://github.com/InverterNetwork/hermes-agent --skill pretext-inverternetwork
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pretext
Source: https://github.com/InverterNetwork/hermes-agent/tree/main/skills/creative/pretext
Command: npx skills add https://github.com/InverterNetwork/hermes-agent --skill pretext-inverternetwork

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @chenglou/pretext, gsap, lil-gui, and includes references (resource) components.

What problem does it solve?

This skill solves the challenge of creating high-performance, creative text layouts in the browser that are not constrained by the limitations of the DOM or CSS reflow.

Core Features & Use Cases

  • DOM-free Measurement: Calculate line breaks, widths, and heights without triggering browser reflows.
  • Creative Typography: Enable kinetic typography, text flowing around moving obstacles, and text-as-geometry games.
  • Use Case: Create a hero section where a paragraph of text dynamically flows around a user-dragged sprite or a morphing 3D object at 60fps.

Quick Start

Use the pretext skill to generate a creative demo that flows a paragraph of text around a moving circular obstacle.

Frequently Asked Questions about pretext

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I render multiline text on an HTML5 Canvas without triggering CSS reflow?

To render DOM-free canvas text without reflow, use the @chenglou/pretext library to calculate line breaks and glyph positions geometrically, completely bypassing CSS reflow for high-performance text layout.

What is kinetic typography and how does it work in creative coding?

Kinetic typography in creative coding animates text dynamically by calculating real-time glyph positions on an HTML5 Canvas. The pretext library handles text segmentation geometrically, enabling fluid text motion without DOM limitations.

Can I flow a paragraph of text around moving obstacles on a Canvas at 60fps?

Yes, you can flow paragraph text around moving obstacles at 60fps by using pretext to recalculate line breaks and glyph positions in real-time, enabling dynamic editorial layouts and text-as-geometry interactions on HTML5 Canvas.

Does pretext work with GSAP for generative text layout animations?

Yes, pretext works with GSAP for generative text layout animations. While GSAP drives the animation timeline, pretext provides the high-performance, DOM-free text measurement and geometric layout calculations needed for kinetic typography.

What is the best way to build editorial text layouts on a Canvas without the DOM?

The best way to build DOM-free editorial text layouts on Canvas is using pretext, which calculates multiline text measurement, line breaks, and glyph positions directly, avoiding browser reflows and enabling high-performance generative art.

Why does my kinetic typography animation stutter when rendering large paragraphs on Canvas?

Kinetic typography animations stutter when relying on the DOM for large paragraph text measurement due to CSS reflow overhead. Using pretext bypasses the DOM entirely, calculating geometric line breaks and glyph positions for smooth 60fps rendering.