Skip to content
animorio
IT
Back to the library

Liquid metal prompt

WebGL, HoverWebGL, GSAPAdvancedCompressed weight: Demo 12 KBGSAP 28 KBFreeDownload the zip

The prompt field of Ondra, a made-up AI assistant, on a near black page. The field is real: you type, the send button lights up and, once sent, turns into a stop square. While the assistant thinks, a thread of liquid metal runs along the edge in hand written WebGL: chrome reflections, a current of thicker beads going round, the metal pooling in the four corners and a faint rainbow of dispersion. When the answer arrives the current slows down and settles into a hairline, and the first line comes in word by word. Under the pointer the metal swells towards it like a drop that is drawn out.

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>
<!--
  "Liquid metal prompt" 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="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>The prompt field with the liquid metal running on its edge while it thinks</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/geist@5.3.0/index.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/geist-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- the prompt field of a made-up AI assistant, Ondra. While it thinks, a thread of liquid metal runs along the
         edge of the field (hand written WebGL), pools in the corners and settles when the answer arrives. Under the
         pointer the metal swells towards it like a drop that is drawn out -->
    <div class="chat">
      <header class="head">
        <svg class="head__mark" viewBox="0 0 24 24" aria-hidden="true">
          <path d="M12 3.2c4.9 0 8.8 3.9 8.8 8.8s-3.9 8.8-8.8 8.8S3.2 16.9 3.2 12"/>
          <path d="M12 8.1a3.9 3.9 0 1 1-3.9 3.9"/>
        </svg>
        <span class="head__name">Ondra</span>
        <span class="head__tag">Assistant</span>
      </header>

      <div class="thread" data-thread aria-live="polite">
        <p class="ask" data-ask><span class="ask__in" data-ask-in></span></p>
        <div class="reply" data-reply>
          <svg class="reply__mark" data-reply-mark viewBox="0 0 24 24" aria-hidden="true">
            <path d="M12 3.2c4.9 0 8.8 3.9 8.8 8.8s-3.9 8.8-8.8 8.8S3.2 16.9 3.2 12"/>
            <path d="M12 8.1a3.9 3.9 0 1 1-3.9 3.9"/>
          </svg>
          <div class="reply__body">
            <span class="thinking" data-thinking>Thinking</span>
            <p class="answer" data-answer></p>
          </div>
        </div>
      </div>

      <form class="field" data-field autocomplete="off">
        <span class="field__rim" aria-hidden="true"></span>
        <label class="sr" for="prompt">Message Ondra</label>
        <textarea class="field__input" id="prompt" data-input rows="2" placeholder="Ask Ondra anything"></textarea>
        <div class="field__bar">
          <button class="tool" type="button" aria-label="Attach a file">
            <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M10 4.5v11M4.5 10h11"/></svg>
          </button>
          <span class="model">
            Ondra 2
            <svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3.2 4.7 6 7.5l2.8-2.8"/></svg>
          </span>
          <button class="send" type="submit" data-send aria-label="Send" disabled>
            <span class="send__face" data-send-face>
              <svg class="send__arrow" data-arrow viewBox="0 0 20 20" aria-hidden="true"><path d="M10 15.5v-11M5.2 9.2 10 4.4l4.8 4.8"/></svg>
              <span class="send__stop" data-stop aria-hidden="true"></span>
            </span>
          </button>
        </div>
        <canvas class="metal" data-metal aria-hidden="true"></canvas>
      </form>
    </div>

    <svg class="cursor" data-cursor viewBox="0 0 24 24" aria-hidden="true"><path d="M5 2.8v16.4l4.2-4 2.8 6.2 2.9-1.3-2.8-6.1h5.9Z"/></svg>
  </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.

28 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 “Liquid metal prompt” 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

On a near black page, Ondra’s mark with the «Assistant» tag at the top and, below, the prompt field: a rounded graphite rectangle with «Ask Ondra anything», the plus to attach, the «Ondra 2» model and the send button off. The edge is a very thin chrome thread, drawn by a shader. You type and the button lights up white with its arrow; pressed, it squashes and comes back with a small elastic, the arrow leaves and a stop square turns into its place. The text leaves the field and rises as a bubble on the right, below it Ondra’s mark turns slowly next to the word «Thinking» with an ice blue sheen running through it. Meanwhile the thread on the edge wakes up: it becomes a tube of liquid metal with running reflections, a current of thicker stretches goes round the field, the metal pools in the corners as if breathing and on the sides the colours split slightly, like a rainbow. After a little more than three seconds the answer arrives: the current slows down, gathers one last time in the corners and settles into the thin thread, the square turns back into the arrow and the first line comes in word by word, out of a blur. Bring the pointer near the edge and the nearest point of the metal swells and stretches towards it like a drop that is drawn out, follows it on a spring and melts back into the thread when you move away. Left alone, a pointer passes over the edge, writes a prompt, sends it and waits by the edge while it thinks, then starts again with another.

How it works

The edge as a distance

A WebGL canvas sits over the field, 40 px larger on every side. For each pixel the shader works out the distance to the rounded rectangle of the field (sdRoundRect) and keeps its absolute value minus a half width: below zero there is metal. The edge is antialiased over one real pixel (0.5 - distance x dpr).

The current and the corners

The half width changes along the way round: atan(y / height, x / width) tells where on the edge you are, and two waves raised to the fifth and twelfth power make thicker stretches that travel with a phase. In the corners (where both coordinates pass the straight part) 2.4 px are added, breathing slowly: the metal pools there. The phase grows with time by how much the assistant is thinking, so when it stops the current slows down by itself.

The chrome and the rainbow

From the distance and its slope (two samples next to it) comes the normal of a tube: upright in the middle of the thread, lying down at its sides. The reflected ray reads a little studio of lights (a strip at the top, one that runs with the way round, a side light and the bounce from the floor); red, green and blue read it at slightly different angles, more towards the sides, and there the dispersion shows.

The drop that is drawn out

In JavaScript the point of the edge nearest the pointer is found, with the direction towards it; the centre of a small sphere goes from there towards the pointer, up to 13 px, on a slightly under damped spring (190 stiffness, 14 damping), so it arrives, goes past and wobbles. In the shader the sphere melts into the thread with a smooth minimum (smin) that grows with the pull: it is the neck of the drop.

The real field

A real textarea: Enter or the button send the text, which rises in a bubble; the arrow leaves and the stop square turns in on back.out. Tapping the square brings the answer at once. The thinking state is a number from 0 to 1 animated by GSAP and read by the shader every frame; when the answer arrives it falls in 1.6 s on power3.inOut while a second number fills and empties the corners.

Without WebGL and on its own

Without WebGL the edge is a chrome conic gradient masked to a frame, which thickens and turns with an @property while it thinks. On its own, a GSAP timeline moves a fake pointer along the edge, writes the prompt at 24 letters a second, presses send, waits by the edge and starts again; a real gesture stops it and it starts again after a few quiet seconds.

Values to change

NameFileDefaultWhat it changes
FLOW_SPEEDscript.js0.42Turns per second of the current around the edge while it thinks.
THICKNESSscript.js2.1Half width in pixels of the metal thread while it thinks.
REST_WIDTHscript.js0.6Half width in pixels of the hairline at rest.
CORNER_POOLscript.js2.4Extra pixels of metal that pool in the corners.
DISPERSIONscript.js0.08How far apart red, green and blue are in the reflections (the rainbow).
PULLscript.js13Pixels the drop stretches towards the pointer.
REACHscript.js80Pixels from the edge at which the metal starts to feel the pointer.
THINK_TIMEscript.js3.2Seconds the assistant thinks before the answer.
SETTLE_TIMEscript.js1.6Seconds the metal takes to slow down and settle when the answer arrives.
TYPE_SPEEDscript.js24Letters per second of the prompt written on its own.
LOOPscript.jstrueLeft alone, it writes, sends and answers again and again.

Try them in the Playground

When to use it

For the field of an AI assistant, a support chat, a copilot inside an app or a search that answers: the metal edge says «working on it» without spinners or bars, and the drop under the pointer makes the field feel alive before you even type. The metal thread on its own also works for a loading card.

On phones

The same animation with adapted sizes: the field takes the width of the screen, the conversation above is measured in height with clamp and vh, the canvas is measured again at every resize. With a finger: a touch near the edge draws the drop towards it; you type and send as in a real chat.

With reduced motion

No current and no drop: the thread stays still and, while it thinks, becomes thicker and brighter with a fade. The prompt appears all at once, the bubble and the answer fade in, no pointer on its own.

Pitfalls

  • The metal is centred on the line of the edge, half out and half in: the canvas must be larger than the field (40 px per side here) and offset by the same amount, or the drop and the glow get cut.
  • atan2 jumps from -0.5 to 0.5 turns on the left of the field: the waves along the way round only use whole multiples of a turn (3, 7, 4), so the jump never shows.
  • With the drop off, the smooth minimum would still swell the thread where the sphere is: when the pull is zero the sphere moves 40 px away and the smoothness falls to 1.5.
  • The phase of the current is added up frame by frame (phase += dt x speed x thinking) instead of being time x speed: so as it slows down it never goes back or jumps.
  • The canvas has pointer-events: none and sits over the field: without it the textarea and the button would no longer get clicks.
  • The normal of the tube comes from the slope of the distance, which inside the drop is still 1: the thickness used for the curvature adds the radius of the drop, or the drop would look flat on top.

Libraries

GSAP 3.15.0, Geist (font variabile) 5.3.0, Geist Mono (font variabile) 5.3.0.

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

Testing

Tested on 13 November 2026

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

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