Skip to content
animorio
IT
Back to the library

The dash relief

WebGL, 3D, HoverWebGL, Canvas, GSAPAdvancedCompressed weight: Demo 9.9 KBGSAP 28 KBFreeDownload the zip

A drawing made of thousands of dashes, like an engraving but in relief: it changes shape by flying through a cloud of dust, spins when you drag it and puffs up when you throw it.

Rebuilt from scratch studying eddy-naboulet.dev by Eddy Naboulet: the idea is theirs; code, copy and images are ours. Read how it’s made

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "The dash relief" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="it">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Il rilievo a trattini</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/standard.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="palco" data-palco>
    <canvas class="tela" data-tela role="img" aria-label="Un disegno fatto di trattini in rilievo che cambia forma e gira"></canvas>
    <!-- i quattro disegni: passandoci sopra (o toccandoli) il rilievo cambia forma -->
    <nav class="angoli" aria-label="Disegni">
      <button class="angolo angolo--alto-sx" type="button" data-forma="sfera" aria-pressed="true">Sfera</button>
      <button class="angolo angolo--alto-dx" type="button" data-forma="segno" aria-pressed="false">Segno</button>
      <button class="angolo angolo--basso-sx" type="button" data-forma="nodo" aria-pressed="false">Nodo</button>
      <button class="angolo angolo--basso-dx" type="button" data-forma="fiore" aria-pressed="false" data-autoclic>Fiore</button>
    </nav>
    <p class="nota" data-nota>Trascina il disegno per girarlo. Passa sugli angoli per cambiarlo.</p>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

21 values to change

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “The dash relief” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

In the middle there is a drawing, for instance a sphere, made only of horizontal dashes: where it is light the dashes are dense and closer, where it is dark they are sparse and further back. Hover one of the four names in the corners and every dash sets off on its own towards its place in the new drawing, curving sideways and in depth: halfway the drawing is a cloud, then it comes back together. Drag it and the relief turns (seen edge-on it is a thin sheet), throw it and it keeps turning and puffs up a little; the mouse, passing by, nudges the nearby dashes away.

How it works

From grey to dashes

Each drawing starts on a small 2D canvas, 168 x 210 cells, in shades of grey. For each cell we check how light it is and whether it sits on an edge; if the value beats that cell’s threshold in the 4 x 4 Bayer matrix, a horizontal dash 72% of the cell long is born there. Depth comes from the same value: light parts sit up to 42 units closer.

One repeated quad

The dashes are a single four-vertex quad drawn thousands of times with drawArraysInstanced. Each copy carries where it starts and ends in the starting shape and in the target one, its tone, a random seed and the curve of its journey: the shader does the rest, rotation and perspective included.

Changing shape

A single number goes from 0 to 1 in 1.15 seconds (power2.inOut), but every dash reads it offset by its seed: t = uMix × 1.45 − seed × 0.45. Halfway through its journey it bends away from the straight line by an arc, sin(π t), sideways and in depth. Live dashes take the new places at random; extra ones shrink to a point.

Turning, throwing, puffing

While dragging, rotation grows by 0.0075 radians per pixel and tilt by 0.005; on release the speed loses e^(−2.6 × dt) and the tilt returns to place in 0.9 seconds. At rest it sways slowly (sin(t × 0.32) × 0.2). The faster it turns, the further each dash moves from the centre, up to 32% more.

Values to change

NameFileDefaultWhat it changes
COLONNEscript.js168 (112 al tocco)Cells across the drawing: higher, finer and more numerous dashes.
TRASFORMAscript.js1.15Seconds of a shape change.
SFASAscript.js0.45How offset the dashes start. With 0 they all start together.
RILIEVOscript.js42Depth of the relief, in drawing units (the drawing is 380 wide).
RAMPAscript.js5 coloriThe colours from the lowest tone to the highest: the whole drawing recolours by changing this list.

Try them in the Playground

When to use it

For a portrait, a logo or an object on the first screen of a portfolio: the same drawing becomes material, and changing it is a gesture people remember.

On phones

Fewer cells (112 x 140) and canvas density at most 1.5. The names sit in a grid under the drawing and are tapped; a sideways finger turns the relief, a vertical one stays with the page. No pointer nudge.

With reduced motion

No cloud, no sway, no inertia and no puffing: the drawing changes at once and turns only while you drag it.

Pitfalls

  • To change shape in the middle of a change, first compute where each dash really is (with the same formula as the shader) and use that as the new start: otherwise the drawing jumps.
  • Unneeded dashes are not deleted: they become zero-length and the shader discards them. Measure that length in the drawing, not on screen: seen edge-on every dash is tiny, and discarding it would make the whole relief vanish.
  • A dash is a fraction of a pixel thick: its edge must be feathered in the fragment (coverage), otherwise half of the dashes vanish depending on where they fall.
  • Inside an iframe on phones a vertical finger must stay with the page: touch-action: pan-y and rotation only sideways.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 9.9 KB; the libraries: GSAP 28 KB.

Testing

Tested on 27 September 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: Done

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All animations