Component · Interactive components

Stretch knit cloth simulation

by Informeek Studio 11 November 2026
Live Grab the knit and pull, then let go

The prompt

Build an interactive cloth simulation for a performance fabric brand called Weftline: a square swatch of knitted fabric held in a frame that you can grab and stretch. Use a mass and spring grid of 24 by 24 nodes (18 on phones) with the border pinned, structural and diagonal springs, stiffness 40000 and damping 14, stepped eight times a frame. When the pointer grabs the swatch, nodes within about 3.6 cells follow the hand with a gaussian falloff, and the drag is limited softly at 30% of the swatch. Let go and it springs back with a small wobble. Render the mesh with WebGL, one textured triangle pair per cell, and draw the knit procedurally in the fragment shader: about one stitch per 20px, each stitch two rounded legs leaning into a V, indigo yarn (#3a3f9a) over dark gaps. Pass the local stretch per vertex: stretched areas get thinner legs and shift toward coral (#ff6b4a), compressed areas darken. Frame it with a 12px #16172b border on a warm #ece9e1 page. Copy: a 68px headline "Pull it. It comes straight back.", a live meter showing the largest stretch as a percentage with a gradient bar, and a dark button "Order six free swatches". Arrow keys pull the centre. After 3s idle an invisible finger pulls and releases. Show a CSS stripe swatch without WebGL and heavy damping for reduced motion.

Written by Informeek Studio to recreate this design. Prompts are not deterministic, so running it again gives a similar result, not an identical one.

Use it in three steps

  1. Copy the prompt with the button above.
  2. Paste it into your AI site builder, or any AI chat that writes code.
  3. Make it yours by changing the yarn colours and the stitch size.

About this cloth simulation

This cloth simulation turns a fabric claim into something you can feel. A square of knitted fabric is held in a frame, and you can grab any part of it and pull. The stitches open up and turn coral where the yarn is under tension, the fabric bunches and darkens on the far side, and a meter beside the headline shows how far you have stretched it. Let go and it snaps back with a small wobble, which is exactly the promise the copy makes.

Under the knit is a simple grid of points joined by springs, with the edges pinned to the frame. Grabbing moves a soft patch of points rather than a single one, which keeps the stretch smooth instead of spiky, and eight small physics steps per frame keep the stiff springs stable. The knit itself is not an image. The shader draws each stitch from the mesh coordinates, so the pattern stretches with the fabric.

Why the prompt works

  • It gives the physics numbers, grid size, stiffness, damping and steps.
  • It explains the soft grab, the detail that stops ugly spikes.
  • It draws the knit procedurally, so it deforms for free.
  • It plans for keys and idle touch.

Where to use it

Activewear, textiles, mattresses, packaging and any product where stretch or recovery is the selling point.

The prompt is shared under CC BY 4.0. Reuse it freely, including commercially, with a credit linking back to this page.

Keep exploring

More prompts like this

See the collection →
Live
Component · Interactive components

Swipe cards deck

Live
Component · Interactive components

Stepper UI for onboarding

Live
Component · Interactive components

Bouncing balls animation for dog toys