Skip to content
animorio
IT
All components

Mini sudoku

Games, HoverGSAP, CSS onlyMediumCompressed weight: Demo 7.8 KBGSAP 28 KBFreeDownload the zip

The daily mini sudoku, six by six, really playable: the chosen square takes a ring that glides from one to the next and lights its row, its column and its box, along with every matching number. A right number lands on a bounce; a wrong one turns red, shakes the square and lights the ones that contradict it. Every full row, column or box does a wave, and on the last number the wave takes the whole grid, the clock stops and ticks itself off.

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>
<!--
  "Mini sudoku" 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>Mini sudoku</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 daily mini sudoku, six by six: the chosen square lights its row, column and box,
         a wrong number shakes, a full line does the wave and the last number solves it -->
    <section class="sd" data-sd aria-label="Mini sudoku">
      <header class="sd__top">
        <span class="sd__title"><span class="sd__name"><span data-outname>Mini sudoku</span></span><span class="sd__status" data-outstatus>8 squares to go</span></span>
        <span class="sd__time" data-time><svg viewBox="0 0 14 14" aria-hidden="true"><circle cx="7" cy="7" r="5.200"></circle><path class="sd__hand" d="M7 4.200V7l1.900 1.300"></path><path class="sd__tick" pathLength="1" d="M4.300 7.200 6.200 9l3.600-4"></path></svg><b data-outtime>0:00</b></span>
      </header>
      <div class="sd__board" data-board>
        <div class="sd__box">
          <button class="sd__cell" type="button" data-cell data-i="0" data-given tabindex="-1" aria-label="Row 1, column 1, 5, given"><b>5</b></button>
          <button class="sd__cell" type="button" data-cell data-i="1" tabindex="-1" aria-label="Row 1, column 2, empty"><b></b></button>
          <button class="sd__cell" type="button" data-cell data-i="2" data-given tabindex="-1" aria-label="Row 1, column 3, 3, given"><b>3</b></button>
          <button class="sd__cell" type="button" data-cell data-i="6" data-given tabindex="-1" aria-label="Row 2, column 1, 1, given"><b>1</b></button>
          <button class="sd__cell" type="button" data-cell data-i="7" data-given tabindex="-1" aria-label="Row 2, column 2, 6, given"><b>6</b></button>
          <button class="sd__cell" type="button" data-cell data-i="8" data-given tabindex="-1" aria-label="Row 2, column 3, 4, given"><b>4</b></button>
        </div>
        <div class="sd__box">
          <button class="sd__cell" type="button" data-cell data-i="3" data-given tabindex="-1" aria-label="Row 1, column 4, 4, given"><b>4</b></button>
          <button class="sd__cell" type="button" data-cell data-i="4" tabindex="-1" aria-label="Row 1, column 5, empty"><b></b></button>
          <button class="sd__cell" type="button" data-cell data-i="5" data-given tabindex="-1" aria-label="Row 1, column 6, 6, given"><b>6</b></button>
          <button class="sd__cell" type="button" data-cell data-i="9" tabindex="-1" aria-label="Row 2, column 4, empty"><b></b></button>
          <button class="sd__cell" type="button" data-cell data-i="10" data-given tabindex="-1" aria-label="Row 2, column 5, 5, given"><b>5</b></button>
          <button class="sd__cell" type="button" data-cell data-i="11" data-given tabindex="-1" aria-label="Row 2, column 6, 2, given"><b>2</b></button>
        </div>
        <div class="sd__box">
          <button class="sd__cell" type="button" data-cell data-i="12" tabindex="-1" aria-label="Row 3, column 1, empty"><b></b></button>
          <button class="sd__cell" type="button" data-cell data-i="13" data-given tabindex="-1" aria-label="Row 3, column 2, 1, given"><b>1</b></button>
          <button class="sd__cell" type="button" data-cell data-i="14" tabindex="-1" aria-label="Row 3, column 3, empty"><b></b></button>
          <button class="sd__cell" type="button" data-cell data-i="18" data-given tabindex="-1" aria-label="Row 4, column 1, 3, given"><b>3</b></button>
          <button class="sd__cell" type="button" data-cell data-i="19" tabindex="-1" aria-label="Row 4, column 2, empty"><b></b></button>
          <button class="sd__cell" type="button" data-cell data-i="20" data-given tabindex="-1" aria-label="Row 4, column 3, 2, given"><b>2</b></button>
        </div>
        <div class="sd__box">
          <button class="sd__cell" type="button" data-cell data-i="15" data-given tabindex="-1" aria-label="Row 3, column 4, 2, given"><b>2</b></button>
          <button class="sd__cell" type="button" data-cell data-i="16" data-given tabindex="-1" aria-label="Row 3, column 5, 3, given"><b>3</b></button>
          <button class="sd__cell" type="button" data-cell data-i="17" data-given tabindex="-1" aria-label="Row 3, column 6, 5, given"><b>5</b></button>
          <button class="sd__cell" type="button" data-cell data-i="21" data-given tabindex="-1" aria-label="Row 4, column 4, 6, given"><b>6</b></button>
          <button class="sd__cell" type="button" data-cell data-i="22" data-given tabindex="-1" aria-label="Row 4, column 5, 4, given"><b>4</b></button>
          <button class="sd__cell" type="button" data-cell data-i="23" data-given tabindex="-1" aria-label="Row 4, column 6, 1, given"><b>1</b></button>
        </div>
        <div class="sd__box">
          <button class="sd__cell" type="button" data-cell data-i="24" data-given tabindex="-1" aria-label="Row 5, column 1, 6, given"><b>6</b></button>
          <button class="sd__cell" type="button" data-cell data-i="25" tabindex="-1" aria-label="Row 5, column 2, empty"><b></b></button>
          <button class="sd__cell" type="button" data-cell data-i="26" data-given tabindex="-1" aria-label="Row 5, column 3, 1, given"><b>1</b></button>
          <button class="sd__cell" type="button" data-cell data-i="30" data-given tabindex="-1" aria-label="Row 6, column 1, 2, given"><b>2</b></button>
          <button class="sd__cell" type="button" data-cell data-i="31" data-given tabindex="-1" aria-label="Row 6, column 2, 3, given"><b>3</b></button>
          <button class="sd__cell" type="button" data-cell data-i="32" data-given tabindex="-1" aria-label="Row 6, column 3, 5, given"><b>5</b></button>
        </div>
        <div class="sd__box">
          <button class="sd__cell" type="button" data-cell data-i="27" data-given tabindex="-1" aria-label="Row 5, column 4, 5, given"><b>5</b></button>
          <button class="sd__cell" type="button" data-cell data-i="28" data-given tabindex="-1" aria-label="Row 5, column 5, 2, given"><b>2</b></button>
          <button class="sd__cell" type="button" data-cell data-i="29" data-given tabindex="-1" aria-label="Row 5, column 6, 3, given"><b>3</b></button>
          <button class="sd__cell" type="button" data-cell data-i="33" data-given tabindex="-1" aria-label="Row 6, column 4, 1, given"><b>1</b></button>
          <button class="sd__cell" type="button" data-cell data-i="34" tabindex="-1" aria-label="Row 6, column 5, empty"><b></b></button>
          <button class="sd__cell" type="button" data-cell data-i="35" data-given tabindex="-1" aria-label="Row 6, column 6, 4, given"><b>4</b></button>
        </div>
        <span class="sd__ring" data-ring aria-hidden="true"></span>
      </div>
      <div class="sd__pad" data-pad>
        <button class="sd__key" type="button" data-key="1" aria-label="Enter 1"><b>1</b></button>
        <button class="sd__key" type="button" data-key="2" aria-label="Enter 2"><b>2</b></button>
        <button class="sd__key" type="button" data-key="3" aria-label="Enter 3"><b>3</b></button>
        <button class="sd__key" type="button" data-key="4" aria-label="Enter 4"><b>4</b></button>
        <button class="sd__key" type="button" data-key="5" aria-label="Enter 5"><b>5</b></button>
        <button class="sd__key" type="button" data-key="6" aria-label="Enter 6"><b>6</b></button>
        <button class="sd__key sd__key--erase" type="button" data-key="0" aria-label="Erase"><svg viewBox="0 0 20 16" aria-hidden="true"><path d="M7 1.500h10.500a1.500 1.500 0 0 1 1.500 1.500v10a1.500 1.500 0 0 1-1.500 1.500H7L1.200 8Z"></path><path d="m10 5.500 5 5m0-5-5 5"></path></svg></button>
        <button class="sd__again" type="button" data-again tabindex="-1"><span>Play again</span></button>
      </div>
    </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.

48 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 “Mini sudoku” 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 white, a light card: at the top the title “Mini sudoku”, how many squares are left and the clock pill counting the seconds; below, the grid of six by six white squares, in six boxes of three by two, with the given numbers in black; at the bottom the dark number pad from 1 to 6 and the erase key. On opening the squares appear from the centre outwards. Tapping a square sends the indigo ring gliding onto it on a small spring; its row, column and box take a light tint and every number equal to the chosen one takes a stronger tint and grows heavy. A right number spins in and bounces, in indigo. A wrong one comes in red, the square shakes its head, the squares already holding that number in the same row, column or box flash red for a moment and the mistake count goes up. When a row, a column or a box is complete its squares hop in a wave starting from the last one placed; when a number is all on the grid its key goes dim. On the last number the wave crosses the whole grid, the title rolls to “Solved!”, the clock turns indigo with its tick drawing itself and the pad gives way to “Play again”. It also plays from the keyboard: arrows, numbers and Backspace.

How it works

The grid and the solution

The solution is a string of 36 digits at the top of the script; the squares without data-given are the ones to fill. A square’s row, column and box come from its index, and the eighteen units (six rows, six columns, six boxes) are lists of six indexes.

The ring and the lights

The ring is a single element, laid by GSAP on the measurements of the chosen square: it travels from one to the next on a spring. The lights are attributes on the squares (chosen, peer, same, wrong) that CSS colours: the script writes no colour.

Right, wrong, complete

On every number the square is compared with the solution. If it is wrong it shakes and the peers holding the same number are found and lit. If it is right the units containing it are checked: the ones that are all right do the wave, each square delayed by its distance.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#4b5bf0The colour of the ring, the player’s numbers and the lights.
GLIDEscript.js0.4How long the ring takes to glide from one square to the next.
SPRINGscript.js1How much the numbers, the keys and the wave bounce.

Try them in the Playground

When to use it

On the games page of a newspaper or an app, as the daily game next to the crossword; on a waiting page, a 404, a newsletter that wants readers back every morning. The same grid carries a nine-by-nine sudoku by changing the string and the sizes.

On phones

The card is at most 276 pixels wide and about 365 tall: it fits any phone screen. The squares are 39 by 38 pixels and the keys 36 tall: easy to hit with a thumb, and nothing depends on hover.

With reduced motion

The ring does not glide: it is on the chosen square at once. The numbers appear in place without spinning, with no shakes or waves; a mistake reads from the red and the count, the end from the title and the clock. The demo’s pointer does not start.

Pitfalls

  • A mistake is not told by red alone: the mistake count changes, the square’s label says “wrong” and an aria-live region announces it.
  • The ring is measured in pixels from the chosen square: when the window changes width it has to be laid again, or it stays where it was.
  • The ring and the squares are different elements: that way the wave can lift the squares without dragging the ring along, and GSAP never stacks two transforms on one element.
  • In a real game the solution does not sit in the page: the server checks it, or anyone can read it in the code.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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