Skip to content
animorio
IT
All components

The generate with AI button

Buttons, HoverGSAP, CSS onlyMediumCompressed weight: Demo 6.5 KBGSAP 28 KBFreeDownload the zip

The Generate button of an AI writing tool, on black: a dark pill with a small four point star. On hover the star turns a little and a gradient edge of light switches on; pressed, the edge starts circling the button with a soft halo, the star shrinks and two tiny stars orbit it, the label turns into Generating and shimmers, and below the draft writes itself word by word; at the end Done with a check that draws itself, and everything settles.

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 generate with AI button" 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 generate with AI button</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- the composer of an AI writing tool on near black: a prompt and a Generate button with a four point star.
         Hovered, the star turns and a soft gradient edge lights up; pressed, the edge starts to circle the button,
         the star splits into two small stars that orbit, the label shimmers, and the draft writes itself below -->
    <section class="card" data-card aria-label="Ovrin writing assistant">
      <header class="card__top">
        <span class="card__doc">
          <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M5.5 2.8h6.2l3.3 3.3v11.1H5.5z"></path><path d="M11.5 2.8v3.5H15"></path><path d="M8 10h5M8 12.8h3.6"></path></svg>
          Launch notes
        </span>
        <span class="card__brand">Ovrin</span>
      </header>

      <form class="prompt" data-form autocomplete="off">
        <label class="prompt__label" for="p">Prompt</label>
        <textarea class="prompt__field" id="p" data-field rows="2" placeholder="Describe what to write" maxlength="140"></textarea>
        <div class="prompt__bar">
          <span class="prompt__hint" data-hint>Tone: friendly · 3 lines</span>
          <button class="gen" type="submit" data-gen aria-label="Generate">
            <span class="gen__halo" data-halo aria-hidden="true"></span>
            <span class="gen__ring" data-ring aria-hidden="true"></span>
            <span class="gen__face" data-face>
              <span class="gen__stars" aria-hidden="true">
                <svg class="gen__star" data-star viewBox="0 0 24 24"><path d="M12 2.5c.5 4.6 2.9 7 9.5 9.5-6.6 2.5-9 4.9-9.5 9.5-.5-4.6-2.9-7-9.5-9.5 6.6-2.5 9-4.9 9.5-9.5Z"></path></svg>
                <svg class="gen__mini" data-mini viewBox="0 0 24 24"><path d="M12 2.5c.5 4.6 2.9 7 9.5 9.5-6.6 2.5-9 4.9-9.5 9.5-.5-4.6-2.9-7-9.5-9.5 6.6-2.5 9-4.9 9.5-9.5Z"></path></svg>
                <svg class="gen__mini" data-mini viewBox="0 0 24 24"><path d="M12 2.5c.5 4.6 2.9 7 9.5 9.5-6.6 2.5-9 4.9-9.5 9.5-.5-4.6-2.9-7-9.5-9.5 6.6-2.5 9-4.9 9.5-9.5Z"></path></svg>
                <svg class="gen__check" data-check viewBox="0 0 24 24"><path d="M5.5 12.5l4.2 4.2 8.8-9.2" pathLength="1"></path></svg>
              </span>
              <span class="gen__label" data-label>Generate</span>
            </span>
          </button>
        </div>
      </form>

      <div class="draft" data-draft aria-live="polite"></div>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></path></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.

20 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 generate with AI button” 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 background, in the middle, the card of Ovrin, a made up writing tool: at the top the Launch notes document, below it the prompt field and at the bottom right the Generate button, a very dark grey pill with a small light four point star. A fake pointer arrives and types Write a short launch note for offline mode, three friendly lines. Then it moves to the button: the star turns twenty two degrees and grows a touch, and round the pill a thin purple, blue and pink gradient edge lights up with a blurred halo. Pressed, the button squashes and springs back with a small bounce; the edge starts circling, one turn every 1.6 seconds, the halo grows stronger, the star shrinks and two tiny stars orbit it half a turn apart, the label scrolls into Generating and a light runs across it letter by letter, while the pill widens on a spring. After a second and a half the draft appears below, three lines writing themselves word by word out of a blur. Then the edge slows down and stops, the tiny stars vanish, a pale green check draws itself where the star was, the label becomes Done and the button gives a little hop. Soon after the light fades, the star and Generate come back; then the draft fades away and the loop starts again. The field and the button really work.

How it works

An edge made of a gradient

Behind the button’s face there are two layers with the same conic gradient: the ring, cut out with a mask that leaves only a one and a half pixel border (content-box against the whole box, with mask-composite), and the halo, the same gradient blurred by 12 pixels. Both read their angle from one CSS variable, --ang.

States are numbers

Edge opacity, halo strength, spin speed and orbit radius are fields of one object that GSAP moves from value to value; GSAP’s ticker writes them into the button’s variables on every frame and advances the angle by the speed, so the spin speeds up and slows down smoothly.

Tiny stars in orbit

The star is a four point SVG path; the two tiny stars are the same shape, smaller, half a turn apart on a 7 by 6 pixel ellipse, with a slight twinkle in size. The orbit radius grows from zero with back.out, so they come out of the star instead of popping in.

The label that changes

Before changing its text the button measures its width, changes it and measures again, then animates the width between the two with back.out: the pill widens on a short spring. Generating has a light gradient sliding through its letters (background-clip text).

The draft

The three lines are split into words that come out of a blur 45 thousandths apart; the draft area has a fixed height, so the card never jumps. The autopilot is a single timeline that stops at the first real touch or key.

Values to change

NameFileDefaultWhat it changes
PROMPTscript.jsWrite a short launch note for offline mode, three friendly lines.The prompt the autopilot types.
DRAFTscript.jsOffline mode is here: keep writing on the train, the plane, anywhere.|Every edit saves on your device and syncs the moment you are back online.|Turn it on in Settings, then forget about the signal.The three lines of the result, split by |.
GRADIENT_Ascript.js#8b6cffThe first colour of the light edge.
GRADIENT_Bscript.js#3fb4ffThe second colour of the light edge.
SPINscript.js1How fast the light edge circles while generating (1 = one turn every 1.6 seconds).
GLOWscript.js1How strong the glow round the button is.
THINK_TIMEscript.js1.6The seconds it generates before writing.

Try them in the Playground

When to use it

For the button that starts the AI in an editor, a writing tool, an image or code generator, a field that summarises or translates: whenever pressing means waiting a few seconds for an answer.

On phones

The card takes the width with a 16 pixel margin, the button drops to 36 pixels and the tone line shortens with an ellipsis; the draft has a fixed height in vh that holds three lines without moving the field. A tap presses and generates like a click; the edge lighting up on hover happens with a mouse, with keyboard focus and with the autopilot.

With reduced motion

The edge does not spin and the tiny stars do not come out: the prompt is already written, the button moves to Generating and Done only with the edge light and a fade, and the draft appears without moving.

Pitfalls

  • A conic gradient does not animate on its own in CSS without @property: GSAP’s ticker writes the angle into a variable, which works in every browser.
  • The edge mask needs both spellings: -webkit-mask-composite: xor for Safari and Chrome, mask-composite: exclude for Firefox.
  • When the label changes the width must be measured before and after: animating width from auto does not work.
  • The autopilot does not focus the field: in the card’s preview the page would have handed focus to the iframe and scrolled.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 25 October 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 components