Skip to content
animorio
IT
All components

Full screen button

Buttons, HoverGSAP, CSS onlyEasyCompressed weight: Demo 4.5 KBGSAP 28 KBFreeDownload the zip

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

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>
<!--
  "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>

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.

13 values to change

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 “Full screen 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

On black, alone in the middle, there is a light pill with the four corners of a frame drawn in thin strokes and the words «Full screen». On tap the pill gives a little and comes back on a spring; the four corners lean out by a pixel along their diagonals, as if the frame were pushed from inside, then each one turns half a turn in place, one after the other clockwise, and lands pointing inwards with a small bounce: the sign for leaving full screen. The whole sign takes a breath as the corners land. Meanwhile a thin amber line leaves the edge of the pill, spreads out like a screen growing and fades; «Full screen» rises away and «Exit» arrives, coming in narrow and opening up on the width axis, and the pill shortens on a spring. On a second tap the line comes back from outside, closes onto the pill and fades, the corners make another half turn, still clockwise, and «Full screen» returns. Hovering brings the pill a touch closer and opens the corners by a pixel. The F key works too, as in a video player. Until someone touches it, the pill plays the gesture by itself.

How it works

Four corners, one turn

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

Always clockwise

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.

The push before the turn

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.

The line that plays the screen

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 word coming in narrow

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.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#ffb020The colour of the line that spreads like the screen.
LABEL_ONscript.jsFull screenThe label at rest.
LABEL_OFFscript.jsExitThe label in full screen.
SPRINGscript.js1How springy the corners and the press are: 0.4 calm, 2 very bouncy.
SPEEDscript.js1The speed of everything: 2 twice as fast, 0.5 half.
SPREADscript.js16How many pixels the line spreads around the pill.
HOLDscript.js2.2How many seconds each state stays when the button plays by itself.
AUTOscript.jstrueThe button plays the gesture by itself until someone touches it.

Try them in the Playground

When to use 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 phones

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.

With reduced motion

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.

Pitfalls

  • Each corner has to turn around the middle of its own little square, not the middle of the icon: turned around the shared centre, the four corners would swap places instead of flipping over.
  • The rotation has to add up (turns × 180) rather than switch between 0 and 180: that way the corners always turn clockwise, even when tapped again halfway through.
  • The press scale has to be divided out when measuring the word: if the pill is at 0.95 while measuring, the word comes out shorter.

Libraries

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.

Testing

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