Skip to content
animorio
IT
All components

Standing desk control

Sliders, Hover, SVGGSAP, CSS onlyMediumCompressed weight: Demo 7.1 KBGSAP 28 KBFreeDownload the zip

The control of a height-adjustable desk, in a card on white: on the right a vertical rail to drag, which is the height you ask for; in the middle the desk drawn in lines, with its oak top, screen and cup, catching up at the speed of its motor and settling with a small bounce; on the left the centimetres counting. Two presets, “Sit” and “Stand”, and a pill saying whether you are sitting, standing or moving. Let go of the handle within two centimetres of a preset and it snaps onto it.

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>
<!--
  "Standing desk control" 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>Standing desk control</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 control of a height-adjustable desk: a vertical slider is the height you ask for, the desk drawn in
         lines catches up at the speed of its motor and settles; two presets, sit and stand -->
    <section class="sd" data-sd aria-label="Standing desk">
      <header class="sd__head">
        <div class="sd__what"><strong>Oak desk</strong><span>Studio, by the window</span></div>
        <span class="sd__pill" data-pill><span class="sd__clip"><span data-outpill>Sitting</span></span></span>
      </header>

      <div class="sd__mid">
        <div class="sd__read">
          <span class="sd__label">Height</span>
          <strong class="sd__big"><b data-outh>72</b><i>cm</i></strong>
          <span class="sd__clip sd__clip--goal"><span data-outgoal>Sit preset</span></span>
        </div>
        <svg class="sd__desk" viewBox="0 0 150 130" aria-hidden="true">
          <ellipse class="sd__shade" data-shade cx="75" cy="124" rx="56" ry="3"></ellipse>
          <path class="sd__floor" d="M6 123.500h138"></path>
          <rect class="sd__inner" data-inner x="33.500" y="72" width="5" height="50"></rect>
          <rect class="sd__inner" data-inner x="111.500" y="72" width="5" height="50"></rect>
          <rect class="sd__outer" x="31" y="84" width="10" height="36" rx="2"></rect>
          <rect class="sd__outer" x="109" y="84" width="10" height="36" rx="2"></rect>
          <path class="sd__foot" d="M22 121.500h28M100 121.500h28"></path>
          <g data-top>
            <g data-screen>
              <rect class="sd__screen" x="52" y="-31" width="46" height="26" rx="3"></rect>
              <path class="sd__stand" d="M75 -5v5M66 -0.800h18"></path>
            </g>
            <path class="sd__cup" d="M110 -9.500v6.500a2 2 0 0 0 2 2h4a2 2 0 0 0 2 -2v-6.500z"></path>
            <rect class="sd__board" x="10" y="0" width="130" height="6.500" rx="3.250"></rect>
            <rect class="sd__beam" x="26" y="6.500" width="98" height="3.500" rx="1.500"></rect>
          </g>
        </svg>
        <div class="sd__rail" data-rail role="slider" tabindex="0" aria-orientation="vertical" aria-label="Desk height" aria-valuemin="62" aria-valuemax="127" aria-valuenow="72" aria-valuetext="72 centimetres">
          <i class="sd__fill" data-fill></i>
          <i class="sd__mark" data-mark="sit"></i>
          <i class="sd__mark" data-mark="stand"></i>
          <span class="sd__knob" data-knob><i></i></span>
        </div>
      </div>

      <div class="sd__presets">
        <button type="button" class="sd__preset" data-preset="sit" aria-pressed="true"><strong>Sit</strong><span data-outsit>72 cm</span></button>
        <button type="button" class="sd__preset" data-preset="stand" aria-pressed="false"><strong>Stand</strong><span data-outstand>112 cm</span></button>
      </div>
      <p class="sd__footline"><span class="sd__clip"><span data-outfoot>Sitting for 48 min. Time to stand</span></span></p>
    </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.

23 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 “Standing desk control” 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 rounded card: at the top “Oak desk”, “Studio, by the window” and on the right the grey pill “Sitting”. In the middle three things in a row: on the left “Height”, the large number “72” with “cm” and under it “Sit preset”; in the centre the desk seen from the front, drawn in black lines, with an oak-coloured top, a screen on its stand, a cup, the two column legs and the floor line with a shadow; on the right a grey vertical rail with a round white handle at the bottom, the stretch under the handle tinted blue and two small ticks where the presets are. Below, two wide buttons: “Sit 72 cm”, with a blue border, and “Stand 112 cm”. At the bottom “Sitting for 48 min. Time to stand”. Tapping “Stand” the handle goes straight up to the high tick with a small bounce, the pill rolls to “Going up”, “Going to 112 cm” appears under the number and the desk rises on its own: the top lifts, the inner legs stretch, the shadow tightens and the centimetres count up to 112. On arrival the top goes a pixel and a half too high and comes back, the screen sways on its stand, the pill turns blue and says “Standing”, at the bottom “Standing. Sit again in 30 min”. Dragging the handle, the desk chases it a moment behind, and the text says “Custom height” when you stop away from the presets. Tab reaches the rail: the arrow keys move one centimetre, Page up and Page down five.

How it works

Two heights, not one

The one asked for (the handle) and the real one (the desk). The handle goes at once where you put it; the desk reaches it in a time that is the distance divided by the motor’s speed.

The desk from one number

From the real height come the y of the top, the height of the inner legs reaching the floor, the width of the shadow and the centimetres written.

Arriving

At the end of the trip the top goes a pixel and a half too far and springs back, and the screen turns two degrees around its stand and comes to rest.

Presets and snapping

The two buttons ask for a height just as the handle would. Let it go two centimetres or less from a preset and the handle lands on it.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#2f6fedThe colour of standing: the pill, the chosen preset, the fill of the rail.
SITscript.js72The sitting height, in centimetres (62 to 127).
STANDscript.js112The standing height, in centimetres (62 to 127).
SPEEDscript.js38How many centimetres a second the desk’s motor does.
LOOPscript.jstrueLeft alone, the demo’s pointer raises the desk, adjusts it by hand and lowers it again.

Try them in the Playground

When to use it

In the app of a motorised desk or an office furniture brand, in a smart home panel, on a product page that lets you try the control; the same pattern, what is asked and the real thing catching up, carries a roller shutter, a blind, an adjustable bed, a car seat back or a room’s volume.

On phones

The card is at most 348 pixels wide and about 300 tall. The rail is 30 pixels wide and 130 tall, all of it touchable, with `touch-action: none` so dragging does not scroll the page. Under 350 pixels the desk drawing narrows to 132 and the number goes down to 38 pixels.

With reduced motion

No trip or bounces: handle, desk and centimetres go straight to the height asked for and the texts change without rolling. The demo’s pointer does not start.

Pitfalls

  • The handle and the desk are two different numbers: with only one, either the handle lags behind the finger or the desk teleports.
  • The state is not told by colour alone: the pill writes “Sitting”, “Standing”, “Going up” or “Going down”, and the rail is a real vertical `role="slider"` with the height in centimetres.
  • The top and the screen are SVG groups moved by writing the `transform` attribute from an animated number: that way the screen turns around its stand and not around its own box.
  • The handle’s run is measured on the rail’s real height at every `resize`, because the preview window changes height while you watch.
  • While dragging, the “Going to … cm” line is written at once: rolling it at every centimetre it would never get to show.
  • The desk’s name, heights and minutes are invented.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

Tested on 3 December 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