Skip to content
animorio
IT
All components

Early bird tickets

Pricing, HoverGSAP, CSS onlyMediumCompressed weight: Demo 5.7 KBGSAP 28 KBFreeDownload the zip

Festival tickets with price tiers: the last three early birds are counted by three small bars, and one is already in the sum. Add tickets and the bars go out one at a time; at the fourth the early birds are gone, the lit plate slides onto “Regular”, the old price is struck through and the total splits in two lines, “3 × €49 early bird” and “+ 1 × €69 regular”, while the figure at the top counts.

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>
<!--
  "Early bird tickets" 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>Early bird tickets</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">
    <!-- ticket pricing with tiers: the last early bird tickets are counted as the quantity grows, and when
         they run out the next tickets are priced at the regular tier, with the total split in two lines -->
    <section class="eb" data-eb aria-labelledby="eb-title">
      <header class="eb__head">
        <span class="eb__name"><b id="eb-title">Weekend pass</b><span>Lumen Festival, 12 – 14 June</span></span>
        <span class="eb__total" aria-live="polite"><b data-total>€49</b></span>
      </header>

      <div class="eb__tiers" data-tiers>
        <i class="eb__on" data-on aria-hidden="true"></i>
        <div class="eb__tier" data-tier>
          <span class="eb__tname">Early bird</span>
          <b data-early-price>€49</b>
          <span class="eb__stubs" data-stubs aria-hidden="true"></span>
          <span class="eb__note"><span data-left>2 left</span></span>
        </div>
        <div class="eb__tier" data-tier>
          <span class="eb__tname">Regular</span>
          <b data-regular-price>€69</b>
          <span class="eb__note"><span>Until 1 June</span></span>
        </div>
        <div class="eb__tier" data-tier>
          <span class="eb__tname">Final</span>
          <b data-final-price>€89</b>
          <span class="eb__note"><span>At the gate</span></span>
        </div>
      </div>

      <div class="eb__row">
        <div class="eb__lines">
          <p class="eb__line"><span data-line-a>1 × €49</span></p>
          <p class="eb__line eb__line--b" data-wrap-b><span data-line-b>1 × €69</span></p>
        </div>
        <div class="eb__qty" role="group" aria-label="Tickets">
          <button class="eb__step" type="button" data-minus aria-label="One ticket less"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 8h8"></path></svg></button>
          <span class="eb__num" aria-live="polite"><b data-qty>1</b></span>
          <button class="eb__step" type="button" data-plus aria-label="One ticket more"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 8h8M8 4v8"></path></svg></button>
        </div>
      </div>

      <button class="eb__go" type="button" data-go><span class="eb__gotext"><span data-golabel>Get tickets</span></span></button>
      <p class="eb__save"><span data-save>Early bird saves you €20</span></p>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></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.

31 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

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 “Early bird tickets” 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 black, a dark card: “Weekend pass”, “Lumen Festival, 12 – 14 June” and on the right the large total, “€49”. Below, three tiers in a row: “Early bird €49” on the lit plate with the amber edge, with three amber bars (one already out, because one ticket is in the sum) and “2 left”; “Regular €69, Until 1 June”; “Final €89, At the gate”. Then the sum line, “1 × €49”, and on the right the stepper: minus, the number, plus. Press plus and the number rolls, another bar goes out and shortens, “1 left”, the total counts up to “€98” with a small jump and the note below says “Early bird saves you €40”. At the third, “None left”. At the fourth ticket the plate slides onto “Regular” on a spring, “€49” stays struck through, the active tier’s name turns amber and under “3 × €49 early bird” a second amber line opens, “+ 1 × €69 regular”; the total counts up to “€216”. Take tickets away and it all goes back: the line closes, the plate returns to “Early bird” and the bars light up again with a bounce. “Get tickets” answers “4 tickets held for 10:00”.

How it works

Everything comes from the quantity

A single function: the early birds are the smaller of the quantity and the ones left (LEFT), the rest go to the regular price. From there come total, lines, bars, lit tier and saving.

The bars

One for each early bird left: when it is taken, opacity and scaleY go down; when it is free again they come back with a bounce.

The plate

A single element under the three tiers, a third wide: it moves with xPercent (0 or 100), so there is nothing to measure again on resize.

The total

A number in an object, taken to the new value by a tween: on every frame it is written rounded, with tabular figures.

The second line

It has zero height until it is needed: it opens to 18 pixels when at least one ticket lands in the regular tier.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#ffb84aThe colour of the active tier, of the early bird tickets and of the button.
EARLYscript.js49The early bird price.
REGULARscript.js69The regular price, for the tickets beyond the last early birds.
LEFTscript.js3How many early bird tickets are left.
MAXscript.js6How many tickets can be taken at once.
SPRINGscript.js1How much the tier plate and the numbers bounce: 0.3 = a little, 2 = a lot.
LOOPscript.jstrueLeft alone, the demo’s pointer adds tickets until the tier changes and then removes them.

Try them in the Playground

When to use it

On the ticket page of a festival, a conference, a course or a concert with tiered presale: when the last discounted tickets are not enough for the whole group and each one’s price has to be said plainly.

On phones

The same card, as wide as the screen minus the margins: the three tiers stay in a row (under 340 pixels prices and bars tighten), and the plus and minus keys are 34-pixel squares in a stepper 40 tall.

With reduced motion

No slides and no bounces: the plate is already on the right tier, the bars go out in one step, numbers and lines change without rolling and the total goes straight to the new figure. The demo does not move by itself.

Pitfalls

  • Festival, prices and availability are made up and no ticket is held: in a real box office the early birds left come from the server and can run out while someone is choosing.
  • The finished tier is not told by colour alone: the price is struck through and below it says “None left”.
  • The bars count tickets, they are not status lights: they are rectangles and they shorten when the ticket is taken.
  • REGULAR cannot be lower than EARLY and MAX is always at least one more than LEFT: the script corrects them, so the tier change always shows.
  • The plate and the struck price are on different elements: GSAP moves the plate, CSS colours the tier with a class.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 24 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