UI & interactionTextile frames round panels
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
- 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.
| Machine | GPU ms | CPU ms | CPU p95 |
|---|---|---|---|
| RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool | 0.03 | 0.21 | 0.34 |
| apple · Apple A19 Proin a browser tab · 16 November 2026 | 2.08 | 0.28 | 0.36 |
| Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026 | 0.07 | 0.33 | 0.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
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
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
- A warm, handmade look for cards and panels (a craft shop, a recipe app, a knitting counter)
- A frame that sews itself in when a panel arrives, or unpicks when it leaves
- A decorative focus and hover state that still keeps the real outline
- Badges, certificates and stickers with a stitched edge
- A look (a theme) where the borders carry the personality
Pitfalls, in brief
- The frame lives in the element’s border, so give it
border: <band> solid transparentandbackground-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. - The canvas sits behind the elements (z-index 0, the elements 1) and draws only the bands.
- 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.
- 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.
- 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
- The frames redraw on resize, scroll inside the container, hover, focus and sewing, and rest otherwise.
- The focus stitch is decoration: keep the element’s own focus outline as well, or forced-colours and screen-magnifier users lose it.
- Under reduced motion (or motion = 0), sew() resolves at once and the frame simply appears; stitches stop marching.
- 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.
- 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.
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.


