Skip to content
animorio
IT
All components

Lottery ticket

Tickets, SVG, HoverGSAP, CSS onlyMediumCompressed weight: Demo 12 KBGSAP 28 KBFreeDownload the zip

The ticket of Lodestar Six, a made-up lottery, on cream security paper with fine guilloche lines, stamp-cut edges, a holographic seal, a serial number and a barcode. Above it sits the draw board with six reels. Pressing Check results spins the reels, which stop one after the other with a small settle; every drawn number that is also on the ticket gets circled in pen, the matched counter goes up and in the end the prize rolls in digit by digit while a line of light runs over the ticket. Play again puts everything back.

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>
<!--
  "Lottery ticket" 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>Lottery ticket</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/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" data-stage>
    <!-- the ticket of Lodestar Six, an invented lottery: Check results spins six reels for the winning numbers,
         every number that is also on the ticket gets circled by hand, the count goes up and the prize rolls in -->
    <section class="lotto" aria-labelledby="l-title" data-card>
      <svg class="defs" aria-hidden="true" focusable="false">
        <defs data-filters></defs>
      </svg>

      <div class="board" data-board>
        <div class="board__head">
          <span class="board__label">Winning numbers</span>
          <span class="board__draw">Draw 1184 · Sat 21 Nov</span>
        </div>
        <ol class="reels" aria-hidden="true" data-reels></ol>
      </div>

      <div class="ticket-wrap" data-ticket-wrap>
        <article class="ticket" data-ticket>
          <svg class="ticket__guilloche" aria-hidden="true" data-guilloche></svg>
          <span class="ticket__sheen" aria-hidden="true"></span>
          <header class="ticket__head">
            <span class="seal" aria-hidden="true" data-seal>
              <svg viewBox="0 0 24 24"><path d="M12 3.2 13.9 10.1 20.8 12 13.9 13.9 12 20.8 10.1 13.9 3.2 12 10.1 10.1Z"/><circle cx="12" cy="12" r="8.6"/><circle cx="12" cy="12" r="10.2"/></svg>
            </span>
            <div class="ticket__name">
              <h2 class="ticket__brand" id="l-title">Lodestar <span>Six</span></h2>
              <p class="ticket__sub">6 from 49 · Saturday draw</p>
            </div>
            <span class="ticket__price"><small>Play</small>$2</span>
          </header>
          <p class="ticket__label">Your numbers</p>
          <ul class="picks" aria-label="Your numbers" data-picks></ul>
          <div class="perf" aria-hidden="true">
            <span class="perf__holes"></span>
            <span class="perf__micro" data-micro></span>
          </div>
          <footer class="stub">
            <svg class="barcode" viewBox="0 0 120 26" preserveAspectRatio="none" aria-hidden="true" data-barcode></svg>
            <p class="stub__serial"><span>Serial</span><b data-serial>2611 0418 7302</b></p>
          </footer>
          <span class="ticket__sweep" aria-hidden="true" data-sweep></span>
        </article>
      </div>

      <div class="result">
        <div class="result__text" aria-hidden="true">
          <p class="result__count"><span class="digit" data-count></span>&nbsp;of 6 matched</p>
          <p class="result__prize"><span class="result__line" data-prize>Match 3 to win</span></p>
        </div>
        <button class="check" type="button" data-check>
          <span class="check__face" data-face>
            <span class="check__shine" aria-hidden="true"></span>
            <span class="check__label" data-label>
              <svg class="check__icon" viewBox="0 0 16 16" aria-hidden="true" data-icon><path d="M13 8a5 5 0 1 1-1.6-3.7"/><path d="M11.8 1.8v2.8H9"/></svg>
              <span data-label-text>Check results</span>
            </span>
            <span class="check__bar" aria-hidden="true"><i data-bar></i></span>
          </span>
        </button>
      </div>
      <p class="sr" aria-live="polite" data-live></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.

51 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 “Lottery ticket” 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 ground there are just two pieces one above the other. At the top the draw board, navy with wide corners and a soft highlight on top: Winning numbers, Draw 1184 · Sat 21 Nov, and six recessed windows like those of a slot machine, shaded at the top and bottom like a drum, empty with a small engraved mark. Below, the Lodestar Six ticket on cream paper, its top and bottom edges cut like a stamp, with a soft layered shadow, the grain of the paper and a security pattern of very fine wavy crossing lines, denser at the sides. At its head the holographic seal with the star, the serif name and the price, then Your numbers with the player’s six numbers, a row of holes with a microtext along the perforation and the stub with the barcode and the serial number. At the bottom the matched count, the prize line and the navy Check results button. Pressed, the button shrinks and comes back with an elastic, the label becomes Drawing and a thin red line along the bottom of the button fills with every reel that stops. The six reels dip by a hair, then spin, blurred vertically by their speed, and stop one after the other, passing the number by four pixels and coming back with a settle. When a drawn number is also on the ticket, its window lights up red and on the ticket the number gets circled in pen: a slightly crooked red stroke that does not close where it began, drawn in half a second, with the number dipping a pixel under the pen; the counter goes up like a reel. In the end You won $40 comes in with rolling digits, a line of light crosses the ticket, the seal changes colour, the ticket rises two pixels and the button becomes Play again with the turning arrow. Play again fades the circles, rolls the numbers out of the reels and puts everything back as it was. Under the mouse the ticket tilts slightly and the light on the paper follows it. Until someone touches it, the ticket checks itself, shows the prize and starts again; when you play, from the second round on the drawn numbers are random.

How it works

The reels with the blur

Every reel is a column of random numbers ending with the drawn number. A GSAP tween takes the column in yPercent to the last number and at the same time y four pixels further, with a power2.out; then an elastic.out brings y back to zero. On every frame the column’s speed becomes the vertical stdDeviation of its own SVG feGaussianBlur, so the numbers blur only vertically and turn sharp again when they stop.

The pen circle

The circle is an ellipse worked out in 52 points, tilted, going round one turn and a tenth: the radius changes with two sines (WOBBLE) and grows slowly, so the end passes outside the start like a real pen. The points are joined with quadratic curves at the midpoints; two paths, a full one and a thin one shifted by half a pixel, are drawn with strokeDashoffset from the length to zero.

The security paper

The pattern is drawn in SVG on every resize: two families of thirteen waves of stacked sines, in opposite phase, crossing as on a banknote, stronger at the sides through a mask. The ticket edges are two repeated radial gradients in the mask, and the shadow is a drop-shadow on the wrapper, so it follows the cuts. The barcode comes from a number generator with a fixed seed.

The rolling digits

The counter is a column from zero to six, the prize a column from 0 to 9 repeated twice for each digit: yPercent takes them to the right number, with a back.out for the counter and a longer power3.out for each digit of the prize. The whole sequence is a GSAP timeline; with nobody touching it, a delayedCall starts again after the result and after the return.

Values to change

NameFileDefaultWhat it changes
PICKSscript.js7, 12, 19, 23, 34, 41The player’s six numbers printed on the ticket.
DRAWscript.js23, 4, 41, 30, 12, 45The six numbers drawn in the first round, in the order of the draw; after that they are random.
PRIZESscript.js0, 0, 0, 40, 250, 12000, 2400000The prize in dollars for 0, 1, 2… 6 matched numbers.
MAXscript.js49The numbers go from 1 to this.
SPINscript.js1.1The seconds the first reel spins.
STAGGERscript.js0.44The seconds between one reel stopping and the next.
OVERSHOOTscript.js4The pixels a reel passes the number by before settling.
WOBBLEscript.js0.05How irregular the pen circle is.
PENscript.js0.5The seconds to circle a number.
SPEEDscript.js1The speed of everything.
AUTOscript.jstrueThe ticket checking itself and starting again until someone touches it.
--penstyle.css#e0442aThe red of the pen, the lit windows and the prize.
--paperstyle.css#fbf7eeThe ticket paper.
--boardstyle.css#131a2bThe draw board.

Try them in the Playground

When to use it

On the site or app of a lottery, a charity raffle, a prize contest or any draw game: the moment someone who bought a ticket checks the results and sees at once which numbers they matched. It also suits picking the winners of an event, a giveaway or a company raffle.

On phones

The piece narrows to 92% of the screen and the reels, the numbers and the barcode get shorter with the height of the box, so the board, the ticket and the button all fit. A tap on the button shrinks it like the mouse; the tilt of the ticket stays mouse only.

With reduced motion

No spinning reels, springs, tilt or light sweep: the drawn numbers fade in one after the other, the pen circles fade in already drawn, the counter and the prize change without rolling and the button labels swap with a fade.

Pitfalls

  • The mask of the stamp edges also cuts the box-shadow: the shadow sits on a wrapper with three drop-shadows, which follows the cut shape.
  • The reel moves in yPercent and not in pixels, so when the window height changes (the phone box resizes) the number stays centred; the four pixel overshoot is a separate y that goes back to zero.
  • A single blur filter for all reels blurred them together even when still: each has its own feGaussianBlur, removed when the reel stops so the number stays sharp.
  • The hover lift of the button uses the CSS translate property: it sits on the button while GSAP shrinks the face inside, otherwise the GSAP transform wiped it out.
  • The circle is worked out again on every round with its seed: the same seed in the round on its own, so the preview video starts again the same and closes by itself.

Libraries

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

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

Testing

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