Skip to content
animorio
IT
All components

Streak button

Buttons, Hover, TransitionsGSAP, CSS onlyEasyCompressed weight: Demo 6.0 KBGSAP 28 KBFreeDownload the zip

The «Done for today» button of a habit app («Read 20 pages»): tap it and it squeezes on a spring, the line-drawn flame lights up and grows a little, the streak count rolls from 11 to 12 days digit by digit, on the week today joins the days before it with one bar of colour, and the button turns into «Done · 12 day streak» with a tick drawing itself. A second tap undoes it: the flame dies down, the count goes back to 11 and the bar pulls back. While lit, the flame slowly changes shape by itself. On white, a single ember accent.

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>
<!--
  "Streak button" 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>Streak button</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 streak button of a habit app: one tap marks today as done, the flame lights up, the count of days
         rolls on, today joins the days before it on the week, and a second tap undoes it -->
    <section class="card" data-card aria-label="Daily habit">
      <span class="card__edge" aria-hidden="true"></span>
      <span class="card__glow" aria-hidden="true" data-glow></span>

      <header class="head">
        <span class="head__title">Read 20 pages</span>
        <span class="head__meta">Daily · 8:30 pm</span>
      </header>

      <div class="streak" aria-live="polite">
        <span class="flame" data-flame aria-hidden="true">
          <svg viewBox="0 0 40 48">
            <path class="flame__body" data-flame-body d="M20 4 C 25 12 33 17 33 29 C 33 38 27 44 20 44 C 13 44 7 38 7 29 C 7 22 11 18 13 13 C 15 18 17 20 19 20 C 19 14 18 9 20 4 Z"/>
            <path class="flame__core" data-flame-core d="M20 25 C 23 29 26 31 26 35 C 26 39 23 41 20 41 C 17 41 14 39 14 35 C 14 31 17 29 20 25 Z"/>
          </svg>
        </span>
        <span class="streak__num" data-num aria-hidden="true"></span>
        <span class="streak__unit">day streak</span>
        <span class="vh" data-say>11 day streak</span>
      </div>

      <div class="week" data-week aria-hidden="true">
        <span class="week__bar" data-bar></span>
        <span class="week__day" data-day>M</span>
        <span class="week__day" data-day>T</span>
        <span class="week__day" data-day>W</span>
        <span class="week__day" data-day>T</span>
        <span class="week__day" data-day>F</span>
        <span class="week__day" data-day>S</span>
        <span class="week__day" data-day>S</span>
      </div>

      <button class="btn" type="button" aria-pressed="false" data-btn>
        <span class="btn__bg" data-btn-bg aria-hidden="true"></span>
        <span class="btn__face btn__face--todo" data-todo>
          <span class="btn__label">Done for today</span>
        </span>
        <span class="btn__face btn__face--done" data-done aria-hidden="true">
          <svg class="btn__tick" viewBox="0 0 16 16" aria-hidden="true"><path data-tick pathLength="1" d="M3.4 8.4 6.6 11.4 12.6 4.8"/></svg>
          <span class="btn__label">Done · <span data-done-n>12</span> day streak</span>
        </span>
      </button>
    </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.

32 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 “Streak button” 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

The card arrives and a thread of light runs along the top edge; the days of the week rise one after another, the four already done joined by an orange bar, today only outlined. The flame is out, drawn in grey lines, next to 11 day streak. Tap and the dark button squeezes and springs back: «Done for today» lifts away, the fill turns peach and «Done · 12 day streak» arrives with a tick drawing itself. Meanwhile the flame fills with orange, rises a little and settles, the count rolls from 11 to 12, the week bar stretches to today and the thread of light passes along the edge again. While lit, the flame slowly changes shape. A second tap puts everything back.

How it works

Both faces in one place

«Done for today» and «Done · 12 day streak» sit on top of each other, absolutely positioned and centred in a button as wide as the card: the hidden label can never widen anything, and the change is only a swap of rising and falling.

The number in columns

Each digit is a column from 0 to 9 moved with yPercent: only the digit that changes rolls, with back.out, the units a moment before the tens.

One bar for the streak

Behind the letters of the week there is a single bar, measured from the real positions of the days: stretching it to today joins it to the days before with no seams between pieces, and it is measured again on resize.

The flame that changes shape

The flame path has three shapes with the same commands; while lit, GSAP moves between them with attr d in a slow back and forth, with no beating and no glow.

Values to change

NameFileDefaultWhat it changes
STREAKscript.js11The days already in the streak before today.
TODAYscript.js4Which day of the week is today, from 0 (Monday) to 6 (Sunday).
DAYS_BEFOREscript.js4How many days of this week are already done before today.
SPRINGscript.js0.55How springy the press, the flame and the bar are (lower means more bounce).
FLAME_LIFTscript.js1.12How much the flame grows when it lights up.
ROLLscript.js0.55Seconds for the number to roll to the next day.
IDLEscript.js6Seconds after your last touch before the demo plays by itself again.

Try them in the Playground

When to use it

In habit, reading, language or workout apps: the daily gesture that marks a goal done and shows the streak growing.

On phones

Everything is in em and the size depends on both the width and the height of the window, so the card fits whole in the phone box; the button is as wide as the card and easy to tap.

With reduced motion

No springs, no shifting flame and no rolling numbers: the two faces cross-fade, the flame takes its colour and the bar is already in place.

Pitfalls

  • The two button labels are absolutely positioned: in a grid the longer one would keep the cell wide even when hidden and the short one would sit off centre.
  • Enter and Space on a real button already arrive as a click: a second keyboard handler would mark and undo in the same press.
  • The week bar is measured in pixels from the positions of the days: it must be measured again on resize.
  • With autoRound off the tick at pathLength 1 really draws itself instead of popping in.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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