
The elastic button
Buttons, Hover, Text
The hours of a small team, four people by four months, in a clean table on white that works like a spreadsheet: dragging across the cells a soft blue frame springs over them, goes a pixel past and settles, the figures inside take weight one after the other from where the gesture began, the months and names it covers light up and at the bottom the sum rolls digit by digit, with the average and the cell count beside it. A month picks its column, a name its row, a tap outside clears it.
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>
<!--
"Timesheet table" 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>The timesheet table that sums the selected cells</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" data-stage>
<!-- the hours of a small team in a table, like a spreadsheet: drag across the cells and one soft frame springs
over them, the months and the names it covers light up, and the footer rolls to their sum.
A month or a name picks its whole column or row; a tap outside the frame clears it -->
<section class="sheet" data-sheet aria-label="Hours logged">
<header class="sheet__head">
<span class="sheet__title" data-title>Hours logged</span>
<span class="sheet__sub" data-sub></span>
</header>
<div class="grid" data-grid tabindex="0" role="grid" aria-label="Hours by person and month. Arrow keys move, Shift and the arrows select, Escape clears.">
<div class="sel" data-sel aria-hidden="true"><span class="sel__fill" data-fill></span><span class="sel__grip" data-grip></span></div>
</div>
<footer class="sheet__foot">
<div class="sum" data-sum>
<span class="sum__label">Sum</span>
<span class="num" data-num aria-hidden="true"></span>
<span class="sum__unit">h</span>
</div>
<span class="hint" data-hint>Drag across the cells</span>
<span class="meta" data-meta></span>
</footer>
<p class="sr" aria-live="polite" data-live></p>
</section>
<svg class="fake" data-fake viewBox="0 0 20 24" aria-hidden="true"><path d="M3 2.2v17.4l4.6-4.4 3 6.6 2.9-1.3-3-6.5h6.3Z"></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>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.
22 values to change
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 “Timesheet table” from Animorio and fit it into my siteThe cells are not coloured one by one: there is a single absolute element above the grid, and GSAP takes its x, y, width and height to the rectangle from the corner of the first cell to the corner of the last, read with offsetLeft and offsetTop. With back.out(OVERSHOOT) the frame goes a pixel past the new cell and comes back: that is what makes it feel elastic. The fill and the border live in the child, which GSAP scales on its own for the press.
Every cell inside gets the is-in class, which takes the variable font's wght axis from 420 to 580 with a CSS transition. Each one's delay is its distance in cells from the starting cell times WAVE seconds, so the weight spreads from where the gesture began. Covered months and names light up by the same rule.
The sum is a row of slots lined up from the right, one per character: every digit is a column from 0 to 9 that GSAP moves by -10% per unit, with back.out and a delay of ROLL_STAGGER from the right; extra slots come in widening, missing ones shrink away on the left. The digits are tabular, so nothing jiggles.
While dragging, the cell under the finger is worked out from the first and the last cell, not with elementFromPoint: outside the table the count stops at the edge and the selection stays whole. The pretend pointer calls the same functions as the real one, with positions read at the start of every stretch; at the first real gesture it stops, and comes back after IDLE seconds.
The grid takes focus: the arrows move the cell, Shift and the arrows widen the selection, Escape clears it, and an aria-live line says how many cells and the sum. With reduced motion the frame goes to its place without sliding, the digits change with a fade and there is no pretend pointer.
| Name | File | Default | What it changes |
|---|---|---|---|
TITLE | script.js | Hours logged | The name of the table, top left. |
UNIT | script.js | h | The unit after the sum. |
SPRING | script.js | 0.42 | The seconds the frame takes to reach the new cells. |
OVERSHOOT | script.js | 1.6 | How far the frame goes past the cells before it settles (0 = not at all). |
WAVE | script.js | 0.03 | The seconds between one cell taking weight and the next, from the starting cell. |
ROLL | script.js | 0.55 | The seconds a digit of the sum takes to roll to its new value. |
ROLL_STAGGER | script.js | 0.03 | The seconds between one digit and the next, from the right. |
IDLE | script.js | 3.5 | The quiet seconds before the pointer that shows it comes back. |
For the tables of a work app or a dashboard where you want to know at once what a part adds up to: a team's hours, a month's expenses, sales by shop, seats sold per night, nights booked per room.
The table takes the screen's width minus 16 pixels a side and the rows are measured on the height too (clamp with vh), so everything fits in the box. With a finger you drag across the cells as with the mouse: inside the grid the touch does not scroll the page, outside it does.
The frame goes to its place without sliding or bouncing, the figures change weight and value with a fade, and there is no pretend pointer: the selections change on their own, still.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 7.9 KB; the libraries: GSAP 28 KB.
Tested on 1 November 2026
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.
Support Animorio
Animorio stays free thanks to the people who support it. If you like, buy us a coffee: it helps us make the next animations.
You asked for
We made it for you: it’s in the library, with the preview, the Playground and the code to copy.
An animation you can’t find, or a site to take apart in the journal: tell us which. We pick the next ones from here.
With your account’s email and password.
or with your email
You’re signed in as .
With your account, you can download the zip of every animation and every pack, for free.