Skip to content
animorio
IT
Back to the library

Discounted price drop

TextGSAP, CSS onlyMediumCompressed weight: Demo 4.6 KBGSAP 28 KBFreeDownload the zip

The price of a made-up lounge chair going on sale, in the clean style of today’s shops with variable type in the lead: an orange line strikes the full price, its digits come loose and fall one at a time with a slight turn, and the new price arrives digit by digit, heavy and then lighter, one pixel past its place before settling. Beside it the discount tag opens with a spring, below the old price stays small and crossed out and the time left in the sale appears.

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>
<!--
  "Discounted price drop" 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 price that drops, the old figure falling away</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" data-stage>
    <!-- the price of a made-up chair goes on sale: a line strikes the old price, its digits come loose and fall one by
         one, the new price arrives digit by digit with a weight that settles, and the -20% tag opens with a spring -->
    <section class="offer" aria-label="Arlo lounge chair, on sale" data-frame>
      <p class="eyebrow"><span class="eyebrow__brand" data-brand>Fenwold</span><span class="eyebrow__soft">Arlo lounge chair</span></p>
      <p class="sub">Solid oak and wool, made to order</p>

      <div class="price-row">
        <div class="price" data-price aria-live="polite">
          <span class="price__old" data-old aria-hidden="true"></span>
          <span class="price__new" data-new aria-hidden="true"></span>
          <svg class="strike" data-strike viewBox="0 0 100 10" preserveAspectRatio="none" aria-hidden="true"><path d="M1 6.2 C 30 4.6, 70 5.4, 99 3.6"/></svg>
          <span class="sr" data-sr>$1,250</span>
        </div>
        <span class="tag" data-tag aria-hidden="true"><span class="tag__in" data-tag-in>−20%</span></span>
      </div>

      <div class="meta">
        <span class="was" data-was aria-hidden="true"><span class="was__num" data-was-num>$1,250</span></span>
        <span class="ends" data-ends>
          <svg class="clock" viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="6.2"/><path d="M8 4.8V8l2.2 1.4" data-hand/></svg>
          <span>Sale ends in 2 days</span>
        </span>
      </div>

      <div class="rule" aria-hidden="true"><span class="rule__fill" data-rule></span></div>
      <p class="note" data-note>Free delivery and 30-day returns</p>
    </section>
  </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.

22 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 “Discounted price drop” 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 warm white background, in the middle, there is the card of a lounge chair from Fenwold, a made-up furniture shop: above, the brand and the name, Arlo lounge chair, and below the full price in large black digits, $1,250. A thin orange line, slightly crooked as if drawn by hand, strikes it from left to right; then the digits come loose one after the other, each turning a little on its own, and fall away, and the line falls with them. Meanwhile the old price reappears small and grey below, and its own line crosses it out. The new price, $1,000, arrives digit by digit from above: each digit comes in heavy, lightens to its weight and goes one pixel past its place before coming back. Beside it the orange −20% tag opens with a spring, its letters widening, below Sale ends in 2 days appears with the clock hand making a turn and a thin line shows how much of the sale is left. The new price breathes once, then everything goes back to the full price with the digits rising back, and the loop starts again.

How it works

Both prices in the same cell

The full price and the sale price sit in the same grid cell, one on top of the other, and each character has its own span: GSAP moves the span, never the text, and the dollar sign is smaller and raised.

The hand-drawn line

The striking line is a slightly curved SVG path, with preserveAspectRatio none and vector-effect non-scaling-stroke so it stays thin at any size. It draws itself with stroke-dashoffset in 0.42 seconds with power2.inOut, then falls along with the digits.

The falling digits

Each old digit drops by more than half its height, with a random turn between minus 16 and 16 degrees, and fades out with power2.in, seven and a half hundredths after the one before: so they come loose one at a time instead of falling as a block.

The weight that settles

The weight of each digit is the --wg variable inside font-variation-settings: GSAP takes it from 300 to 740 and then to 560 with keyframes, while the digit drops to its place plus OVERSHOOT pixels with power3.out and another tween brings it back to zero.

The tag and the sale

The tag opens from 0.5 to 1 with back.out(2.4) and its width goes from 70 to 100 on the wdth axis; the small old price is crossed out by a pseudo-element in scaleX read from --barra, and the clock hand turns once around its centre with svgOrigin.

Values to change

NameFileDefaultWhat it changes
PRODUCTscript.js'Arlo lounge chair'The name of the made-up product on sale.
PRICEscript.js1250The full price, in dollars.
DISCOUNTscript.js20The discount as a percentage: the new price and the tag are worked out from it.
FALLscript.js0.55The seconds of an old digit falling.
OVERSHOOTscript.js1The pixels the new digit goes past its place before settling.
HOLDscript.js4.2The seconds the sale price stays still before going back to full.

Try them in the Playground

When to use it

For the page of a product on sale, a promotion page or a shop’s Black Friday: the discount is seen happening, not just read, and the old price stays beside it to say how much is saved.

On phones

The same animation with adapted sizes: the digits are sized on width and height together, the tag stays beside the price and the lines below narrow with them.

With reduced motion

No falls and no springs: the full price fades into the sale price, and the tag, the crossed-out old price and the end of the sale fade in already in place.

Pitfalls

  • The old digits fall with y in pixels and the new ones arrive with yPercent and y together: two different properties, so the one-pixel settle does not cancel the arrival.
  • In Mona Sans the tabular figures draw a slashed zero, which is confusing next to a crossed-out price: the digits stay proportional.
  • The animated weight goes into font-variation-settings through a CSS variable: font-weight alone does not animate smoothly on variable fonts in every browser.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 27 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 animations