Singularity & Liquid Grid
progrmoiz · Collection

Click inside the demo to interact. Use Prev / Next to switch. About this demo · All demos · Awesome · Guides

Pretext demo case study

About Singularity & Liquid Grid

Three experiments: black-hole text singularity, liquid dashboard grid, and draw-to-fill text vessels.

Collection Built by progrmoiz 500+ words CreativeUI

Three experiments: black-hole text singularity, liquid dashboard grid, and draw-to-fill text vessels.

What It Does

This collection showcases three boundary-pushing creative applications of Pretext layout. The first experiment wraps text around a gravitational singularity—a black hole at the center of the canvas that distorts and attracts the text, bending character positions as if caught in a warped spacetime. The second transforms a dashboard of text blocks into a fluid system where blocks drift between grid positions as if flowing like liquid through interconnected chambers. The third invites you to draw a freeform shape with your mouse, then watches text pour into and fill that custom vessel, respecting the drawn boundary while maintaining readability.

Each experiment answers a different question about what text layout can do. They're not practical tools; they're explorations of aesthetic and interactive possibility. Together, they demonstrate that Pretext unlocks creative territories normally closed to web designers and developers. Text becomes malleable, responsive, and alive.

Technical Highlights

These experiments leverage Pretext's real-time measurement and dynamic layout functions to achieve effects that would be prohibitively expensive with traditional DOM APIs. The singularity applies non-linear position transformations to every character every frame, requiring constant re-measurement. The liquid grid continuously re-flows text blocks into new container configurations, recalculating line breaks and character positions as the layout shifts. The draw-to-fill uses a custom boundary shape as the layout constraint, requiring frame-by-frame intersection testing against the drawn path.

The codebase is unapologetically creative, prioritizing visual impact and interactivity over pragmatic production use. Yet it serves an important purpose: proving that Pretext enables designers and developers to think beyond the grid and the rectangle.

Pretext APIs Used

API Purpose
layout() Recalculate text flow within dynamic container shapes and positions
measure() Obtain character positions for singularity distortion and boundary testing
Custom layout functions Apply gravitational warping, liquid flow constraints, and draw-based boundaries

How to Try It

Visit the live demo at pretext.cool to explore all three experiments. Interact with each: feel the pull of the singularity, watch the liquid grid flow, and draw your own text vessels. Browse the source code on GitHub to see how each creative effect is implemented and how Pretext powers the calculations beneath the visuals.

Built By

Created by progrmoiz. Find more Pretext projects and resources at pretext.cool.

Why this matters for Pretext developers

Singularity & Liquid Grid is useful because it makes text layout visible as a programmable system, not a browser side effect. The same idea applies to production UI work: chat messages, virtual lists, dashboards, canvas editors, rich-text tools, localized interfaces, and animated typography all benefit when text size can be predicted before rendering.

Pretext keeps that loop predictable. prepare() captures the expensive font and segment measurements once, while layout() can be reused at different widths without triggering DOM reads. That separation is what lets interactive demos stay responsive while still using real text, real glyph widths, and real line wrapping.

When evaluating this demo, inspect how the text responds to resizing, pointer input, animation timing, and repeated state changes. Those are the moments where traditional DOM measurement usually becomes fragile: hidden measurement nodes drift from the real render tree, layout reads force synchronous reflow, and rapid updates produce visible jank. A Pretext-based implementation keeps the measurement model explicit, which makes the behavior easier to port into real product interfaces.

Related Pretext resources