
The elastic button
Buttons, Hover, Text
The account menu of a project app, in the style of real product interface pieces, on white: press the avatar with the initials and the menu grows out of its corner on a short spring while the items come in staggered. A highlight slides under the item you point at, the shortcut key sits in relief, and in the Theme row a small segmented switch slides its pill: picking Dark fades the menu itself into its dark theme.
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>
<!--
"Account menu" 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 account menu that opens from the avatar</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 account menu of a product app: it grows out of the avatar in the corner of the top bar, a highlight slides under the
item you point at, the Theme row has its own segmented switch, and choosing Dark turns the menu itself dark -->
<div class="frame" data-frame>
<header class="bar">
<div class="bar__brand">
<svg class="bar__mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 4v16"></path><path d="M18 4 9.5 12 18 20"></path><path d="M12.6 9.2 18 4"></path></svg>
<span class="bar__name">Kelvra</span>
</div>
<nav class="bar__nav" aria-label="Main">
<span class="bar__link is-on">Projects</span>
<span class="bar__link">Reports</span>
</nav>
<button class="avatar" type="button" data-avatar aria-haspopup="menu" aria-expanded="false" aria-controls="menu-account" aria-label="Account menu for Iris Calder">
<span class="avatar__face" data-face>IC</span>
</button>
</header>
<div class="menu" id="menu-account" role="menu" data-menu aria-label="Account" hidden>
<div class="menu__head" data-item-static>
<span class="menu__face" aria-hidden="true">IC</span>
<span class="menu__who">
<span class="menu__name">Iris Calder</span>
<span class="menu__mail">iris@kelvra.app</span>
</span>
</div>
<div class="menu__list" data-list>
<span class="menu__hl" data-hl aria-hidden="true"></span>
<button class="item" type="button" role="menuitem" data-item>
<svg class="item__icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="8.5" r="3.6"></circle><path d="M4.8 19.6a7.4 7.4 0 0 1 14.4 0"></path></svg>
<span class="item__label">Profile</span>
</button>
<button class="item" type="button" role="menuitem" data-item>
<svg class="item__icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3.2" y="5.6" width="17.6" height="12.8" rx="2.4"></rect><path d="M3.2 9.8h17.6"></path><path d="M6.8 14.6h3.6"></path></svg>
<span class="item__label">Billing</span>
<span class="item__note">Pro</span>
</button>
<button class="item" type="button" role="menuitem" data-item>
<svg class="item__icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="2.8" y="6" width="18.4" height="12" rx="2.4"></rect><path d="M6.4 9.6h.01M9.8 9.6h.01M13.2 9.6h.01M16.6 9.6h.01M8 14.2h8"></path></svg>
<span class="item__label">Keyboard shortcuts</span>
<kbd class="key" data-key>?</kbd>
</button>
<div class="item item--theme" role="menuitem" tabindex="-1" data-item data-theme-row>
<svg class="item__icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="8.4"></circle><path d="M12 3.6v16.8a8.4 8.4 0 0 0 0-16.8Z" class="fill"></path></svg>
<span class="item__label">Theme</span>
<span class="seg" role="radiogroup" aria-label="Theme" data-seg>
<span class="seg__pill" data-pill aria-hidden="true"></span>
<button class="seg__btn is-on" type="button" role="radio" aria-checked="true" aria-label="Light" data-mode="light">
<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="3.8"></circle><path d="M12 2.8v2.2M12 19v2.2M2.8 12H5M19 12h2.2M5.5 5.5l1.6 1.6M16.9 16.9l1.6 1.6M5.5 18.5l1.6-1.6M16.9 7.1l1.6-1.6"></path></svg>
</button>
<button class="seg__btn" type="button" role="radio" aria-checked="false" aria-label="Dark" data-mode="dark">
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M19.4 14.6A7.8 7.8 0 0 1 9.4 4.6a7.8 7.8 0 1 0 10 10Z"></path></svg>
</button>
<button class="seg__btn" type="button" role="radio" aria-checked="false" aria-label="System" data-mode="system">
<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="3.4" y="4.6" width="17.2" height="11.6" rx="2"></rect><path d="M9 20h6M12 16.2V20"></path></svg>
</button>
</span>
</div>
<span class="menu__rule" aria-hidden="true"></span>
<button class="item item--out" type="button" role="menuitem" data-item data-out>
<svg class="item__icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M13.6 4.4H6.4a1.8 1.8 0 0 0-1.8 1.8v11.6a1.8 1.8 0 0 0 1.8 1.8h7.2"></path><path d="M10.4 12h9.4"></path><path d="M16.6 8.6 20 12l-3.4 3.4"></path></svg>
<span class="item__label">Sign out</span>
</button>
</div>
</div>
</div>
<svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></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.
37 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 “Account menu” from Animorio and fit it into my siteThe menu’s transform-origin is on the avatar’s corner. GSAP takes it from scaleX 0.16 and scaleY 0.08, with 26 pixel corners, to its size with back.out, while a CSS variable, --alza, lengthens the shadow. The parts come in after a quarter of the opening, 35 milliseconds apart.
Under the items there is one absolute rectangle: on the item you point at it takes its offsetTop and height in three tenths with power3.out. So it slides instead of lighting each item, and the arrow keys move it the same way.
Every colour of the menu is a CSS variable; the is-dark class changes them all, and 0.35 second CSS transitions on background, text and borders make the fade. The switch’s pill slides to the chosen button with back.out and the icon turns 40 degrees and back.
The bar and the menu sit in a frame as tall as the open menu: the poster and the video frame that, so the menu never leaves the shot when it opens.
| Name | File | Default | What it changes |
|---|---|---|---|
ACCENT | script.js | #5b5bd6 | The colour of the avatar’s ring and of the Pro tag. |
OPEN_TIME | script.js | 0.5 | How many seconds the menu takes to grow out of the avatar. |
SPRING | script.js | 1.3 | How far the menu overshoots its size before settling (0 none). |
STAGGER | script.js | 0.035 | The seconds between one item and the next as they come in. |
PAUSE | script.js | 0.9 | The seconds the autopilot waits between gestures. |
For the top right corner of any app or dashboard with an account: a SaaS product, a dashboard, a team tool, the profile of an online shop; and anywhere the light or dark theme should be one tap away instead of buried in settings.
The same menu: the bar drops Projects and Reports and keeps the mark and the avatar, the menu stays up to 268 pixels wide inside the frame, and a tap on the avatar opens it like a click.
No springs or falling items: the menu fades in and out, the highlight and the pill jump into place, the theme still changes with a fade and the drawn pointer is gone.
GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.
Compressed with gzip, the three demo files weigh 6.6 KB; the libraries: GSAP 28 KB.
Tested on 26 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.