
The elastic button
Buttons, Hover, Text
One button, one sign, in the simple style of product interface pieces: the light «Full screen» pill on black with the four corners of a frame drawn in thin strokes; on tap the corners lean out by a pixel, then turn round in place one after the other, clockwise, until they point inwards, the sign for exit. A thin line in the accent colour leaves the pill and spreads out like a screen growing, and the label becomes «Exit».
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>
<!--
"Full screen 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>The full screen button with the corners turning round</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>
<!-- one button, one sign: the four corners of the frame turn round in place and point inwards -->
<button class="full" type="button" data-full aria-pressed="false" aria-label="Full screen">
<span class="full__halo" data-halo aria-hidden="true"></span>
<span class="full__body" data-body>
<svg class="full__icon" viewBox="0 0 32 32" aria-hidden="true">
<path class="full__corner" data-corner="tl" d="M7.5 13V7.5H13"/>
<path class="full__corner" data-corner="tr" d="M19 7.5h5.5V13"/>
<path class="full__corner" data-corner="br" d="M24.5 19v5.5H19"/>
<path class="full__corner" data-corner="bl" d="M13 24.5H7.5V19"/>
</svg>
<span class="full__label" aria-hidden="true">
<span class="full__word" data-word="on">Full screen</span>
<span class="full__word" data-word="off">Exit</span>
</span>
</span>
</button>
</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.
13 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 “Full screen button” from Animorio and fit it into my siteThe icon is an SVG of four L-shaped paths. Each one turns around the middle of its own little square (svgOrigin): half a turn takes the point from outside to inside, and the exit corner is the same drawing upside down. That is why no second icon is needed.
The rotation adds up on every tap (180, 360, 540…): the corners never retrace their steps, they always turn the same way, and back.out makes them land a hair too far before they settle.
Before turning, each corner moves 1.2 pixels along its diagonal in 0.12 seconds and comes back on a spring while it turns: that anticipation makes the frame look pushed from inside. The corners start 55 thousandths apart.
Behind the pill sits a one-pixel border in the accent colour: GSAP animates its inset from 0 to minus 16 pixels while it fades. On exit it does the opposite: it comes in from outside, closes onto the pill and disappears.
The old word leaves before the new one arrives, which comes up from below with the wdth axis at 75 and lands at 100 with back.out: the two are never read together. The pill’s width follows the new word, measured in its final shape.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #ffb020 | The colour of the line that spreads like the screen. |
LABEL_ON | script.js | Full screen | The label at rest. |
LABEL_OFF | script.js | Exit | The label in full screen. |
SPRING | script.js | 1 | How springy the corners and the press are: 0.4 calm, 2 very bouncy. |
SPEED | script.js | 1 | The speed of everything: 2 twice as fast, 0.5 half. |
SPREAD | script.js | 16 | How many pixels the line spreads around the pill. |
HOLD | script.js | 2.2 | How many seconds each state stays when the button plays by itself. |
AUTO | script.js | true | The button plays the gesture by itself until someone touches it. |
For the button that takes a video, a photo gallery, a presentation or a map to full screen: the sign turning round says by itself which way you are going, with no need for two icons.
On the phone the pill and the icon take their size from the screen (clamp on the shorter side); there is no hover, everything else is the same.
The corners swap with a fade, already turned, the line does not spread and the words swap with a fade; the pill takes its new width at once.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 4.5 KB; the libraries: GSAP 28 KB.
Tested on 30 October 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.