Skip to content
animorio
IT
All components

Engraving text field

Forms, Hover, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 9.3 KBGSAP 28 KBFreeDownload the zip

The product card of a brushed steel pen from Wren & Ash, a made-up stationery maker, with the engraving field. Every letter typed is cut into the barrel: a thin line of light cuts it, the letter is born ember-warm and cools into the grey of cut steel, with the light lip under the groove. The letters already cut slide to stay centred, deleted ones are buffed away. Serif, Script and Mono re-engrave the whole name, the style pill stretches as it travels and the total rolls up by 12 dollars.

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>
<!--
  "Engraving text field" 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 engraving field with the name that engraves itself on the pen</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces@5.3.0/full.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/caveat@5.3.0/index.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/jetbrains-mono@5.3.0/index.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- the product card of Wren & Ash, an invented stationery maker: a brushed steel pen with a free text field.
         Every letter typed is engraved on the barrel by a thin line of light, glows warm for a moment and cools to
         steel; the three type styles re-engrave the whole name; the total rolls up by the price of the engraving -->
    <section class="card" data-card aria-labelledby="card-title">
      <header class="card__head" data-rise>
        <span class="card__brand">
          <svg viewBox="0 0 20 20" aria-hidden="true"><path d="M4 15.5 12.6 6.9a2 2 0 0 1 2.8 0l-.3-.3a2 2 0 0 1 0 2.8L6.5 18H4z"/><path d="M11.4 8.1l2.8 2.8"/></svg>
          Wren &amp; Ash
        </span>
        <span class="card__name" id="card-title">Signet pen, brushed steel</span>
      </header>

      <div class="pen" data-pen data-rise>
        <svg class="pen__svg" viewBox="22 24 556 80" aria-hidden="true" data-svg>
          <defs>
            <linearGradient id="steel" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" stop-color="#7d8288"/>
              <stop offset=".16" stop-color="#d9dde1"/>
              <stop offset=".3" stop-color="#fbfcfd"/>
              <stop offset=".44" stop-color="#c6cacf"/>
              <stop offset=".64" stop-color="#9da2a8"/>
              <stop offset=".86" stop-color="#6c7177"/>
              <stop offset="1" stop-color="#4c5156"/>
            </linearGradient>
            <linearGradient id="ring" x1="0" y1="0" x2="0" y2="1">
              <stop offset="0" stop-color="#5a5f65"/>
              <stop offset=".3" stop-color="#b9bec3"/>
              <stop offset=".6" stop-color="#4a4f54"/>
              <stop offset="1" stop-color="#2f3337"/>
            </linearGradient>
            <linearGradient id="sheen" x1="0" y1="0" x2="1" y2="0">
              <stop offset="0" stop-color="#fff" stop-opacity="0"/>
              <stop offset=".5" stop-color="#fff" stop-opacity=".75"/>
              <stop offset="1" stop-color="#fff" stop-opacity="0"/>
            </linearGradient>
            <filter id="brush" x="0" y="0" width="100%" height="100%">
              <feTurbulence type="fractalNoise" baseFrequency="0.004 0.9" numOctaves="2" seed="7"/>
              <feColorMatrix values="0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .5 0"/>
              <feComposite in2="SourceGraphic" operator="in"/>
            </filter>
            <filter id="soft" x="-20%" y="-200%" width="140%" height="500%"><feGaussianBlur stdDeviation="7"/></filter>
            <clipPath id="body">
              <path d="M58 41h340v38H58a19 19 0 0 1 0-38z"/>
              <rect x="398" y="40" width="12" height="40"/>
              <path d="M410 40h132a20 20 0 0 1 0 40H410z"/>
            </clipPath>
          </defs>
          <ellipse class="pen__shadow" cx="300" cy="96" rx="250" ry="7" filter="url(#soft)"/>
          <ellipse class="pen__contact" cx="300" cy="84" rx="230" ry="2.6" filter="url(#soft)"/>
          <g clip-path="url(#body)">
            <rect x="30" y="40" width="540" height="40" fill="url(#steel)"/>
            <rect x="30" y="40" width="540" height="40" fill="#fff" filter="url(#brush)" opacity=".35"/>
            <rect x="398" y="40" width="12" height="40" fill="url(#ring)"/>
            <rect class="pen__sheen" data-sheen x="-60" y="40" width="120" height="40" fill="url(#sheen)"/>
          </g>
          <path class="pen__edge" d="M58 41.5h340M410 40.5h132"/>
          <path class="pen__clip" d="M428 30.5h108a5.5 5.5 0 0 1 0 11H428a3 3 0 0 1 0-11z"/>
          <path class="pen__clip-shine" d="M440 32.6h94"/>
        </svg>
        <div class="engrave" data-engrave aria-hidden="true">
          <span class="engrave__line" data-line></span>
          <span class="engrave__text" data-text></span>
        </div>
        <span class="pen__hint" data-hint>Your name, here</span>
      </div>

      <div class="field" data-rise>
        <div class="field__top">
          <label class="field__label" for="engraving">Engraving</label>
          <div class="styles" role="radiogroup" aria-label="Type style" data-styles>
            <span class="styles__pill" data-pill aria-hidden="true"></span>
            <button class="styles__opt is-on" type="button" role="radio" aria-checked="true" data-style="serif">Serif</button>
            <button class="styles__opt" type="button" role="radio" aria-checked="false" data-style="script">Script</button>
            <button class="styles__opt" type="button" role="radio" aria-checked="false" data-style="mono">Mono</button>
          </div>
        </div>
        <div class="field__box" data-box>
          <input class="field__input" id="engraving" type="text" maxlength="14" autocomplete="off" spellcheck="false" placeholder="Add a name or initials" data-input>
          <span class="field__count" data-count>0/14</span>
        </div>
      </div>

      <footer class="foot" data-rise>
        <div class="foot__price">
          <span class="foot__label">Total</span>
          <span class="foot__total" data-total aria-live="polite"></span>
          <span class="foot__extra" data-extra>Engraving +$12</span>
        </div>
        <button class="bag" type="button" data-bag>
          <span class="bag__in" data-bag-in>
            <span class="bag__word" data-bag-word>Add to bag</span>
            <svg class="bag__check" viewBox="0 0 20 20" aria-hidden="true"><path data-check d="M5 10.4l3.2 3.2L15 6.8"/></svg>
          </span>
        </button>
      </footer>
    </section>

    <svg class="pointer" viewBox="0 0 24 24" aria-hidden="true" data-pointer><path d="M5 3.5 18.5 12 12.4 13.6 9.4 19.6z"/></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.

33 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 “Engraving text field” 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 white page there is a white card with soft corners, a one pixel border and a layered shadow. At the top the Wren & Ash brand with a small drawn pen and, on the right, Signet pen, brushed steel. Below, in a very light grey panel lit from above, a brushed steel pen drawn in SVG: the barrel with the shading of a cylinder and the fine lines of the brushing, the dark ring, the cap with its clip, a sheen drifting slowly along the metal and following the pointer, the soft shadow beneath. Lower down the Engraving field with the character counter, on the right the three pills Serif, Script and Mono each set in its own typeface, and at the bottom the total and the Add to bag button. Every letter typed is cut into the barrel: a thin warm line of light crosses it, the letter appears behind the line ember-coloured, with a glow, and in just over a second cools into the grey of cut steel, with the light lip under the groove and the dark lip above. The name stays centred: the letters already cut slide sideways, deleted ones blur and fade. Changing style, the white pill stretches toward the choice and settles with a small bounce, the name blurs and is cut again letter by letter in the new typeface. With the first letter the total rolls from $64.00 to $76.00 digit by digit and Engraving +$12 appears; near 14 characters the counter turns amber and past the limit the field shakes. Add to bag gives under the finger, turns into Added with a check that draws itself and then goes back. Left alone, a drawn pointer types Mara & Leo, tries the three styles, adds the pen and deletes the name.

How it works

The pen in SVG, the text in HTML

The pen is an SVG with a vertical cylinder gradient, a turbulence stretched horizontally for the brushing and a soft-light band for the sheen. The engraved name is HTML on top of the barrel: the script reads where the barrel ended up on screen (viewBox and scale) and lays a container over it, each letter a span. So the letters animate one by one and the browser's real fonts are kept.

The cut and the cooling

Every new letter joins a queue: the line of light goes to the letter's left edge and crosses it in ENGRAVE_TIME while a clip-path uncovers it behind the line. It is born warm with a glow, then in COOL_TIME goes to the grey of steel with two text shadows: a light one a pixel below and a dark one a pixel above, which make the groove.

The name always centred

Before the letters change, the ones that stay are measured; afterwards each starts from where it was and slides to its new place (the FLIP technique). Deleted ones become absolute where they are and blur away, so they do not push the others.

The stretching pill

The style pill first widens to cover the old and the new choice, then tightens on the new one with back.out: you see it travel. The name blurs, changes typeface and size and is cut again faster, letter by letter.

The rolling total

The digits of the total are columns from 0 to 9 inside a one-line window: they move with yPercent to the right digit, each with a slightly different duration, and Engraving +$12 slides in beside them.

Values to change

NameFileDefaultWhat it changes
ENGRAVE_TIMEscript.js0.16Seconds the line of light takes to cut one letter.
COOL_TIMEscript.js1.1Seconds a freshly cut letter takes to go from warm to steel.
RESTYLE_GAPscript.js0.05Seconds between letters when a new style re-engraves the name.
SLIDE_TIMEscript.js0.36Seconds the cut letters take to slide and stay centred.
BASE_PRICEscript.js64The price of the pen, in dollars.
ENGRAVING_PRICEscript.js12What the engraving adds, in dollars.
MAX_CHARSscript.js14The longest engraving the barrel takes.
SPEEDscript.js12 = the drawn pointer twice as fast, 0.5 = half.
LOOPscript.jstrueThe drawn pointer plays the story again and again.

Try them in the Playground

When to use it

On the page of a product you can personalise: a pen, a watch, a piece of jewellery, a key ring, a water bottle, a knife, a leather wallet or a name tag. It shows straight away how the object will look and what it costs extra, and turns the dullest text field in the shop into the nicest moment of the purchase. It also suits a corporate gift with a name or a card with initials.

On phones

The same animation with adapted sizes: the card is 94% of the screen wide, the pen panel, the field and the button are sized on the height too, and under 380 pixels the product name at the top hides. The field is a real input: on the phone it opens the keyboard and every letter is cut just as on desktop.

With reduced motion

Nothing moves: the letters fade in already steel-coloured, with no line of light and no sliding, the pill jumps to the choice, the total changes in place and the sheen on the metal stays still.

Pitfalls

  • The pen is an SVG that fits through its viewBox: the letters' container must be measured again on every resize from the viewBox and the scale, otherwise the name slides off the barrel.
  • The warm colour and the steel are animated with text-shadow: the two shadow lists need the same number of shadows and the same kinds of values, or GSAP jumps from one to the other with nothing in between.
  • A deleted letter that stays in the flow pushes the others while it fades: make it absolute where it stands before it disappears.
  • The font size is computed once per style so that 14 characters fit the barrel: changing it with every letter makes the name jump.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Fraunces (font variabile) 5.3.0, Caveat (font variabile) 5.3.0, JetBrains Mono (font variabile) 5.3.0.

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

Testing

Tested on 8 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 components