Feature Library

Textile frames round panels

0.03 GPU · 0.21 CPU ms
A still of the Textile frames round panels demo
Still
The live demo starts when it’s in view.Point at a frame or tab to it · Sew in and Unpick at the top · Sew again on a card

Woven, knitted and embroidered borders for any element: mark it `data-textile="twill"` and its own border becomes cloth, drawn thread by thread on the GPU.

What it costs a frame

0.03 ms
0.21 ms
GPU
0.03 ms
CPU, median
0.21 ms
CPU, 95th pct
0.34 ms
Draw calls
0
Weight
Light

Measured 13 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged GPU 0.03–0.03, CPU 0.20–0.21 ms). What ran: Measured while every frame is being sewn in, over and over (eight bands and a cord, one instanced draw), timed by its own timestamp query. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool0.030.210.34
apple · Apple A19 Proin a browser tab · 16 November 20262.080.280.36
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20260.070.330.56

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

How steadily it runs on Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258V · in a browser tab

Typical frame ?
16.70 ms
1% low ?
53 fps
Varies by ?
±0.50 ms
All metricsIntel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258V · in a browser tab
p50p95p9916.03 ms18.24 ms +
How long each frame took. Most frames sit in the tall bars; a long tail to the right is hitching.

Frames run on a 60 Hz timer (a page demo), so most frames take about one tick, 16.7 ms: the spread around it is what matters.

Frames

Median (p50) ?
16.70 ms
p95 ?
17.57 ms
p99 ?
17.95 ms
Slowest ?
22.71 ms
Mean ?
16.76 ms
Standard deviation ?
0.50 ms
1% low ?
53 fps
0.1% low ?
44 fps
Hitches ?
0 of 600
Over budget ?
0 of 600

Main thread

Long tasks ?
0
Long frames ?
0
Event-loop delay ?
0.1 / 0.6 / 0.7 ms

Input

No input during this run. A browser-tab run plays none.

Memory

JavaScript heap ?
83.4 → 83.4 MB
Growth ?
-0.01 MB

What it needs

Renders with
WebGPUNeeds WebGPU: current Chrome and Edge, Safari 26+, Firefox 141+ on Windows.
Your browser
Checking…Looking for WebGPU
Depends on
NothingNo other packages

What it’s for

  1. A warm, handmade look for cards and panels (a craft shop, a recipe app, a knitting counter)
  2. A frame that sews itself in when a panel arrives, or unpicks when it leaves
  3. A decorative focus and hover state that still keeps the real outline
  4. Badges, certificates and stickers with a stitched edge
  5. A look (a theme) where the borders carry the personality

Pitfalls, in brief

  1. The frame lives in the element’s border, so give it border: <band> solid transparent and background-clip: padding-box (textile-frames.css does both for [data-textile]); a background that reaches under the border hides the frame, and padding in place of a border leaves the band nowhere to be measured.
  2. The canvas sits behind the elements (z-index 0, the elements 1) and draws only the bands.
  3. Stitched patterns follow the outline and fit their repeat to its length (the nearest pitch that divides it), so they close without a seam at the start; woven ones run along each side and meet on a 45° mitre, as bound cloth does.
  4. The outline coordinate is measured on the outer edge, so stitch columns stay radial round a corner; a band wider than the corner radius squares off inside, which is how a real binding turns.
  5. Colours are read with getComputedStyle when the frames are created and on refresh(): after a theme change, a palette change or new elements, call refresh() (a MutationObserver catches added elements and class changes, not a changed stylesheet).
5 more in brief
  1. The frames redraw on resize, scroll inside the container, hover, focus and sewing, and rest otherwise.
  2. The focus stitch is decoration: keep the element’s own focus outline as well, or forced-colours and screen-magnifier users lose it.
  3. Under reduced motion (or motion = 0), sew() resolves at once and the frame simply appears; stitches stop marching.
  4. A lost device (a driver reset, the GPU process gone) turns the frames into the CSS stand-ins (mode becomes "css", sews finish at once); pass onLost to say so.
  5. Name patterns by technique, not by people or places, and do not copy a tradition’s motifs: several named textile patterns are protected or held by their communities.
10 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From HaTac. Fully custom code.

Inigo Quilez, 2D distance functions: The rounded box distance (sdRoundBox) that finds the band and its depth, in WGSL and TypeScript.

Mark Jarzynski & Marc Olano, Hash Functions for GPU Rendering (JCGT, 2020): The PCG hash behind the slubs, the felt and the cloth.

textileborderframeweavetwillknitcross-stitchembroideryrunning stitchsatin stitchblanket stitchcorddom + gpucss custom propertiesraw webgpuwgslfocusreduced motiondraw on demandtimestamp queriesno dependencies

Near it in the frame