Skip to content
animorio
IT
Back to the library

Springy control center

Physics, HoverGSAP, CSS onlyMediumCompressed weight: Demo 9.8 KBGSAP 28 KBFreeDownload the zip

A phone screen of a made-up system, Halden OS: pull the handle at the top right down and the control center falls in with gravity, overshoots a little, bounces and settles. The four tiles, Wi-Fi, Bluetooth, Focus and Airplane, are not glued to the panel: each hangs on its own spring, so during the fall they lag, swing and settle a beat later, and the outer ones tilt. Grab one and pull it and it stretches as on a rubber band while its neighbours follow through springs between them, like a block of jelly; let go and they all swing back. The brightness and volume sliders have mass: the fill trails the finger slightly, keeps going when flung, slows down with friction and, pushed past an end, stretches the track and springs back. Brightness really dims the wallpaper. All the physics is hand written, springs, damping and friction, with no library.

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>
<!--
  "Springy control center" 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 control center with tiles hanging on springs and sliders that carry momentum</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>
    <!-- a phone screen with a made-up launcher, Halden OS. Pull the handle down and the control center falls in with
         gravity and bounces; the four tiles hang on springs and swing with the fall, drag one and its neighbours follow
         like jelly. The two sliders have mass: they trail the finger, keep going when flung, slow down with friction and
         stretch past the ends -->
    <section class="phone" data-phone aria-label="Phone screen">
      <div class="wall" aria-hidden="true">
        <span class="wall__glow wall__glow--a"></span>
        <span class="wall__glow wall__glow--b"></span>
      </div>
      <header class="bar" aria-hidden="true">
        <span class="bar__time">9:41</span>
        <span class="bar__icons">
          <svg viewBox="0 0 18 12"><path d="M1 11h2.2V8H1zM5.3 11h2.2V6H5.3zM9.6 11h2.2V3.6H9.6zM13.9 11h2.2V1h-2.2z"/></svg>
          <svg viewBox="0 0 26 12"><rect x="1" y="1.5" width="21" height="9" rx="2.6" fill="none" stroke="currentColor" stroke-width="1.1"/><rect x="2.6" y="3.1" width="14.2" height="5.8" rx="1.4"/><path d="M23.6 4.6v2.8c.8-.3 1.3-.8 1.3-1.4s-.5-1.1-1.3-1.4z"/></svg>
        </span>
      </header>
      <div class="home" data-home aria-hidden="true">
        <p class="home__date">Sunday 8</p>
        <p class="home__clock">9:41</p>
      </div>
      <button class="handle" data-handle type="button" aria-label="Pull down the control center">
        <span class="handle__bar"></span>
      </button>

      <div class="shade" data-shade aria-hidden="true"></div>
      <section class="cc" data-cc aria-label="Control center">
        <div class="cc__sheen" aria-hidden="true"></div>
        <div class="tiles" data-tiles>
          <button class="tile is-on" data-tile type="button" aria-pressed="true">
            <span class="tile__body" data-body>
              <span class="tile__icon"><svg viewBox="0 0 24 24"><path d="M2.5 9.2a14 14 0 0 1 19 0M5.6 12.6a9.6 9.6 0 0 1 12.8 0M8.7 16a5.2 5.2 0 0 1 6.6 0"/><circle cx="12" cy="19.2" r="1.3"/></svg></span>
              <span class="tile__text"><span class="tile__name">Wi-Fi</span><span class="tile__state" data-state>Home</span></span>
            </span>
          </button>
          <button class="tile is-on" data-tile type="button" aria-pressed="true">
            <span class="tile__body" data-body>
              <span class="tile__icon"><svg viewBox="0 0 24 24"><path d="M7 7.5l10 9-5 4.5v-18l5 4.5-10 9"/></svg></span>
              <span class="tile__text"><span class="tile__name">Bluetooth</span><span class="tile__state" data-state>Buds</span></span>
            </span>
          </button>
          <button class="tile" data-tile type="button" aria-pressed="false">
            <span class="tile__body" data-body>
              <span class="tile__icon"><svg viewBox="0 0 24 24"><path d="M19.5 14.6A8 8 0 0 1 9.4 4.5a8 8 0 1 0 10.1 10.1z"/></svg></span>
              <span class="tile__text"><span class="tile__name">Focus</span><span class="tile__state" data-state>Off</span></span>
            </span>
          </button>
          <button class="tile" data-tile type="button" aria-pressed="false">
            <span class="tile__body" data-body>
              <span class="tile__icon"><svg viewBox="0 0 24 24"><path d="M2.5 13.6l8-3.4V4.4a1.5 1.5 0 0 1 3 0v5.8l8 3.4v2.1l-8-2v4.3l2.4 1.7v1.4L12 20.1l-3.9 1v-1.4l2.4-1.7v-4.3l-8 2z"/></svg></span>
              <span class="tile__text"><span class="tile__name">Airplane</span><span class="tile__state" data-state>Off</span></span>
            </span>
          </button>
        </div>

        <div class="slider" data-slider="light" role="slider" tabindex="0" aria-label="Brightness" aria-valuemin="0" aria-valuemax="100" aria-valuenow="46">
          <span class="slider__track" data-track>
            <span class="slider__fill" data-fill></span>
            <span class="slider__icon slider__icon--sun" aria-hidden="true">
              <svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="4.2"/><g class="rays" data-rays><path d="M12 2.2v2.4M12 19.4v2.4M2.2 12h2.4M19.4 12h2.4M5.1 5.1l1.7 1.7M17.2 17.2l1.7 1.7M5.1 18.9l1.7-1.7M17.2 6.8l1.7-1.7"/></g></svg>
            </span>
            <span class="slider__value" data-value>46</span>
          </span>
        </div>
        <div class="slider" data-slider="sound" role="slider" tabindex="0" aria-label="Volume" aria-valuemin="0" aria-valuemax="100" aria-valuenow="62">
          <span class="slider__track" data-track>
            <span class="slider__fill" data-fill></span>
            <span class="slider__icon" aria-hidden="true">
              <svg viewBox="0 0 24 24"><path class="spk" d="M4 9.2h3.4L12 5v14l-4.6-4.2H4z"/><path class="wave" data-wave d="M15.2 9.2a4 4 0 0 1 0 5.6"/><path class="wave" data-wave d="M17.8 6.8a7.4 7.4 0 0 1 0 10.4"/></svg>
            </span>
            <span class="slider__value" data-value>62</span>
          </span>
        </div>
        <p class="cc__hint">Drag the tiles. Fling the sliders.</p>
      </section>
    </section>

    <svg class="pointer" data-pointer viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.5 18.5 12 12.4 13.6 9.4 19.6z"/></svg>
    <p class="sr" aria-live="polite" data-live></p>
  </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.

38 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 “Springy control center” 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 a light grey page stands a phone with a dark bezel, the purple, blue and orange wallpaper of a blurred sunset, the bar on top with 9:41 and the large date and time in the middle. At the top right there is a handle: pull it down and the control center, a frosted glass panel, comes down from the top, goes a few pixels past its place, rises again and settles after a couple of bounces, while the screen behind blurs and darkens. Inside are four tiles in two rows and two sliders. The tiles do not follow the panel to the letter: each hangs on a spring, so during the fall they lag behind for a moment, come down after, swing and stop; the ones in the second row swing more and the side ones tilt outwards. A tap turns a tile on or off: it squashes a little and comes back, turns light with the blue circle of its icon and changes the word under its name. Hold a tile and drag it and it moves away as on a rubber band, harder and harder to pull, leaning the way it goes; the other three follow it as much as they are close, as if tied by springs, and when you let go they all swing back to their places together. The sliders are wide pills: dragged, the white part trails the finger slightly, as if it had weight; flung with a flick it keeps going and slows down with friction; pushed past the start or the end it stretches the track by a few pixels and springs back. The brightness sun opens and turns its rays as it rises and the phone wallpaper really brightens or darkens; the speaker waves light up one by one with the volume. The number on the right gives the percentage. A tap outside the panel closes it upwards. Left alone, a drawn pointer opens the panel, turns Focus on, raises the brightness and flings it, pulls the Wi-Fi tile, pushes the volume past zero, puts everything back and closes it.

How it works

One loop for all the physics

A requestAnimationFrame takes three small physics steps per frame (one long step with stiff springs would turn unstable) and then writes the transforms. Panel, tiles and sliders are numbers with a position and a velocity: no tweens, only forces.

The falling panel

The panel's position goes to its place on a lightly damped spring: force equals stiffness times distance minus damping times velocity. With a low DROP_DAMPING it overshoots and bounces. Each step keeps the acceleration, because the tiles need it.

The hanging tiles

Each tile has an x, y offset and a rotation, held at zero by its own spring. At each step it gets a push opposite to the panel's acceleration, stronger in the second row: so it lags when the panel falls and swings when it stops. Left and right tiles turn opposite ways.

The jelly

The grabbed tile follows the finger on a rubber band that hardens (the offset is divided by one plus the distance over 160). The others get a force toward its offset, divided by the square of the distance in cells: the neighbour on the side and the one below follow, the diagonal one less.

Sliders with mass

While held, the slider value goes to the finger's point on a stiff spring divided by SLIDER_MASS: the fill arrives a moment later. The finger's speed is measured; on release it becomes the value's velocity, which then drops with friction. Past 0 or 1 a spring brings it back in and the track stretches in proportion, from the right side.

One input for the real finger and the drawn one

The down, move and up functions decide what is held (handle, tile, slider or outside) and are used by both the pointer events and the autopilot, a GSAP timeline that moves the drawn pointer and calls the same functions. The first real pointer stops the autopilot.

Values to change

NameFileDefaultWhat it changes
DROP_STIFFNESSscript.js170Stiffness of the falling panel's spring: higher, a faster and tighter fall.
DROP_DAMPINGscript.js13Damping of the fall: lower, more bounces before it settles.
TILE_SWINGscript.js0.05How much the tiles lag and swing when the panel moves.
TILE_STIFFNESSscript.js240Spring holding each tile to its place.
JELLYscript.js0.55How strongly a dragged tile pulls its neighbours (0: they stay still).
SLIDER_MASSscript.js1How heavy the slider fill feels: higher, it trails the finger more.
FRICTIONscript.js4.2How fast a flung slider slows down.
STRETCHscript.js0.12How much the track stretches when pushed past an end.
LOOPscript.jstrueLeft alone, the drawn pointer keeps playing.

Try them in the Playground

When to use it

For the launch page of a phone app or system, for a site explaining a product through its settings, for a smart home device page: wherever a control panel should feel like a real object, with weight, springs and friction, instead of appearing flat.

On phones

The same physics with adapted sizes: the drawn phone is sized on the screen height and everything inside scales with it. Pull the handle with a finger, drag tiles and sliders; taps switch the tiles.

With reduced motion

No falls, swings or momentum: the control center is already open, tiles switch on and off without squashing, sliders go straight where you take them and brightness changes the wallpaper. No drawn pointer.

Pitfalls

  • Stiff springs with one step per frame blow up when a frame runs long: the step is split in three and capped at a thirtieth of a second.
  • The tiles are buttons in the grid: the transform goes on their inner body, not on the button, or the grid and the tap move with it.
  • A tap on a tile and a drag start the same: it is decided on release, if it moved more than 6 pixels it was a drag.
  • The fling speed must be measured during the drag, smoothed, not between the first and last points: otherwise a slow drag ending with a flick does not fly.
  • The slider's number and icon sit over the white fill or the dark track depending on the value: their colour is chosen every frame.
  • With the panel closed its position depends on its height: it is measured again on resize, or a strip stays visible at the top.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 8 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 animations