Skip to content
animorio
IT
Back to the library

Giveaway draw

Text, HoverGSAP, CSS onlyMediumCompressed weight: Demo 6.1 KBGSAP 28 KBFreeDownload the zip

The winner draw of a giveaway: the entrants’ names run past like a reel inside a window, smeared by speed, slow down giving the frame a small kick at every row and stop on a little bounce. The winner’s name gains weight, the frame lights up coral, the Winner tag pops out in place of the ticket number and a light crosses the row. Draw again picks another.

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>
<!--
  "Giveaway draw" 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>Giveaway draw</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 winner draw of a giveaway: the entries run past like a reel, slow down
         and stop on the winner, whose name gains weight inside the frame -->
    <section class="gw" data-gw aria-label="Giveaway draw">
      <header class="gw__top">
        <span class="gw__mark" aria-hidden="true"><svg viewBox="0 0 20 20"><path d="M3.500 8.500h13v8h-13ZM2.500 5.500h15v3h-15ZM10 5.500v11M10 5.500C8.200 5.500 6.300 4.700 6.300 3.300 6.300 1.600 9.200 1.800 10 5.500ZM10 5.500c1.800 0 3.700-.800 3.700-2.200C13.700 1.600 10.800 1.800 10 5.500Z"></path></svg></span>
        <span class="gw__title"><b>Lumen launch giveaway</b><span class="gw__status"><span data-outstatus>1,284 entries, closed today</span></span></span>
      </header>
      <div class="gw__reel" data-reel>
        <ul class="gw__track" data-track>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">MO</span><b>@maya.okafor</b><span class="gw__ticket">#0482</span></li>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">TR</span><b>@tomasrey</b><span class="gw__ticket">#1107</span></li>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">AL</span><b>@lindqvist.a</b><span class="gw__ticket">#0039</span></li>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">NH</span><b>@noor_h</b><span class="gw__ticket">#0876</span></li>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">JB</span><b>@jules.b</b><span class="gw__ticket">#0214</span></li>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">KS</span><b>@kenji.sato</b><span class="gw__ticket">#1260</span></li>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">AP</span><b>@ana.pereira</b><span class="gw__ticket">#0651</span></li>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">OB</span><b>@o.bennett</b><span class="gw__ticket">#0923</span></li>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">PN</span><b>@priya.n</b><span class="gw__ticket">#0158</span></li>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">LM</span><b>@leo.marchetti</b><span class="gw__ticket">#1033</span></li>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">SK</span><b>@sofia.k</b><span class="gw__ticket">#0770</span></li>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">DO</span><b>@dan.osei</b><span class="gw__ticket">#0345</span></li>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">HI</span><b>@hana.ito</b><span class="gw__ticket">#1191</span></li>
            <li class="gw__row" data-entry><span class="gw__avatar" aria-hidden="true">FW</span><b>@felix.w</b><span class="gw__ticket">#0507</span></li>
        </ul>
        <span class="gw__frame" data-frame aria-hidden="true"><span class="gw__tag" data-tag>Winner</span><span class="gw__shine" data-shine></span></span>
        <span class="gw__sparks" data-sparks aria-hidden="true"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></span>
      </div>
      <button class="gw__btn" type="button" data-btn><span class="gw__btntext"><span data-outbtn>Draw winner</span></span></button>
    </section>
    <span class="live" aria-live="polite" data-live></span>

    <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.

57 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 “Giveaway draw” 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, with a faint warm light behind it, a dark card: at the top the giveaway’s gift box, its name and how many entered; in the middle a window with three rows of entrants (initials, handle, ticket number), faded above and below, with a thin frame on the middle row; at the bottom the coral “Draw winner” button. On opening the reel comes down three rows and stops. Tap the button and it tightens and bounces, its label rolls to “Drawing” and the names set off fast, smeared; then they slow down, and at every row going by the frame gives a small start. At the last one the reel goes three pixels past the point and springs back: the name inside the frame grows heavier, the initials’ circle turns coral, the frame lights up, the ticket number makes room for the “Winner” tag popping out with a turn, a band of light crosses the row and a few short lines leave the edges. At the top “Winner drawn” rolls in with the ticket number, and the button becomes “Draw again”.

How it works

A seamless reel

The list is written twice in a row. One number says which row is in the middle, counted in rows: the script wraps it inside the list’s length and moves the strip accordingly, so it can spin as many times as it likes.

The spin and the braking

The winner is picked at random before setting off, never the same as before. GSAP takes the number to it after TURNS full passes, in SPIN seconds with a long braking; the smear depends on how many rows go by in a frame.

The winner’s weight

Once the reel has stopped, the middle row takes a class: CSS takes the variable font’s weight from 480 to 780 on a transition, the Winner tag comes in on a spring and the short lines leave from the frame’s edge.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#ff7a59The colour of the button, the frame and the winner.
SPINscript.js3.2How many seconds the reel of names spins before stopping.
TURNSscript.js3How many times the whole list goes by before the winner.

Try them in the Playground

When to use it

On the page of a contest or a product launch, at the end of a live event, in the panel of whoever runs a community or a newsletter; and to pick at random among several names: who presents today, who buys coffee, the order of a running list.

On phones

The card is at most 320 pixels wide and narrows with the screen, about 270 tall. The rows stay 44 pixels tall; long names are cut with an ellipsis. The button is as wide as the card.

With reduced motion

The reel does not spin: the names fade and come back already stopped on the winner, who takes weight, frame and tag with no springs, lights or lines. The demo’s pointer does not start.

Pitfalls

  • The winner is decided before the reel sets off, and in a real contest the server decides: the animation shows a result, it does not produce it.
  • While spinning, the button has aria-busy and ignores taps; the drawn name lands whole in an aria-live region, because to a screen reader the reel is just noise.
  • The second copy of the list is hidden from screen readers with aria-hidden, otherwise every entrant would be read twice.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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