Skip to content
animorio
IT
Back to the library

Services toggle card

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

A two way switch, Heart or Reason, in the services card of a made-up branding studio, Ardent & Axis. Until someone touches it, it calls for attention: every five seconds the knob is kicked toward the other side and comes back bouncing on its stop like a real spring, each bounce half the one before, while a glow in the card's colour breathes around it. Pressed, it squashes; let go, it crosses on a spring that stretches it as it travels. On the change the card turns from warm to rational: the photo wipes in from the side, the title and the three services swap in a cascade, the fee rolls digit by digit and a glass chip on the photo works out the button's WCAG contrast live and picks white or dark words on its own.

Rebuilt from scratch studying loloagency.com by The Agency of Love & Logic, Stas Bondar: the idea is theirs; code, copy and images are ours. Read how it’s made

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>
<!--
  "Services toggle card" 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>Ardent and Axis, services</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/newsreader@5.3.0/opsz-italic.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- the services card of a made-up brand studio, Ardent and Axis. A two way switch, Heart or Reason, calls for a
         touch with a spring nudge until someone uses it, with a glow that breathes around it. Switching changes the
         tone of the whole card between warm and rational: the photo, the title, the three services in a cascade, the
         fee rolling digit by digit, and a contrast check worked out live while the colours move -->
    <article class="card" data-card>
      <span class="card__grain" aria-hidden="true"></span>

      <header class="top">
        <span class="mark">
          <svg class="mark__sign" viewBox="0 0 20 20" aria-hidden="true">
            <path class="mark__arc" d="M3.5 15.5a6.5 6.5 0 0 1 13 0"/>
            <path class="mark__axis" d="M10 3.2v13.6M5.4 16.8h9.2"/>
          </svg>
          <span>Ardent &amp; Axis</span>
        </span>

        <button class="toggle" type="button" role="switch" aria-checked="false" aria-label="Show the reason side of the studio" data-toggle>
          <span class="toggle__halo" aria-hidden="true" data-halo></span>
          <span class="toggle__track" aria-hidden="true" data-track>
            <span class="toggle__knob" data-knob><span class="toggle__face" data-face></span></span>
            <span class="toggle__label is-on" data-label="0">Heart</span>
            <span class="toggle__label" data-label="1">Reason</span>
          </span>
        </button>
      </header>

      <figure class="photo" data-photo>
        <img class="photo__img is-on" data-img="0" src="argilla.webp" alt="Hands shaping wet terracotta clay on a potter's wheel" width="1024" height="714">
        <img class="photo__img" data-img="1" src="cemento.webp" alt="A pale concrete wall cut at an angle against a clear blue sky" width="1024" height="683">
        <figcaption class="photo__case">
          <span class="swap" data-swap="case"><span class="swap__item is-on">Clayhouse, 2026</span><span class="swap__item">Meridian Hall, 2025</span></span>
        </figcaption>
        <div class="ratio" data-ratio>
          <span class="ratio__head">
            <span class="ratio__name">Button contrast</span>
            <span class="ratio__value"><span data-ratio-num>5.0</span>:1</span>
            <span class="ratio__grade" data-ratio-grade>AA</span>
          </span>
          <span class="ratio__track" aria-hidden="true"><span class="ratio__fill" data-ratio-fill></span><span class="ratio__pin" data-ratio-pin></span></span>
        </div>
      </figure>

      <div class="title" data-title>
        <h2 class="title__set title__set--heart is-on" data-set="0"><span class="mask"><span class="line">Brands people</span></span><span class="mask"><span class="line">fall for, slowly.</span></span></h2>
        <h2 class="title__set title__set--reason" data-set="1"><span class="mask"><span class="line">Positioning that</span></span><span class="mask"><span class="line">holds its ground.</span></span></h2>
      </div>

      <div class="rows" data-rows>
        <ul class="rows__set is-on" data-rowset="0">
          <li class="row"><svg class="row__tick" viewBox="0 0 14 14" aria-hidden="true"><path d="M2.6 7.4l2.8 2.8 6-6.4"/></svg><span class="row__name">Naming and voice</span><span class="row__time">2 weeks</span></li>
          <li class="row"><svg class="row__tick" viewBox="0 0 14 14" aria-hidden="true"><path d="M2.6 7.4l2.8 2.8 6-6.4"/></svg><span class="row__name">Art direction</span><span class="row__time">3 weeks</span></li>
          <li class="row"><svg class="row__tick" viewBox="0 0 14 14" aria-hidden="true"><path d="M2.6 7.4l2.8 2.8 6-6.4"/></svg><span class="row__name">Spaces and events</span><span class="row__time">On site</span></li>
        </ul>
        <ul class="rows__set" data-rowset="1">
          <li class="row"><svg class="row__tick" viewBox="0 0 14 14" aria-hidden="true"><path d="M2.6 7.4l2.8 2.8 6-6.4"/></svg><span class="row__name">Brand strategy</span><span class="row__time">2 weeks</span></li>
          <li class="row"><svg class="row__tick" viewBox="0 0 14 14" aria-hidden="true"><path d="M2.6 7.4l2.8 2.8 6-6.4"/></svg><span class="row__name">Research and audits</span><span class="row__time">10 days</span></li>
          <li class="row"><svg class="row__tick" viewBox="0 0 14 14" aria-hidden="true"><path d="M2.6 7.4l2.8 2.8 6-6.4"/></svg><span class="row__name">Brand architecture</span><span class="row__time">3 weeks</span></li>
        </ul>
      </div>

      <footer class="foot">
        <p class="fee">
          <span class="fee__label">Engagements from</span>
          <span class="fee__value" data-fee aria-hidden="true"></span>
          <span class="sr" data-fee-text>24 thousand dollars, 6 weeks</span>
        </p>
        <a class="cta" href="#" data-cta>
          <span class="cta__bg" aria-hidden="true"></span>
          <span class="cta__words">Start a project</span>
          <svg class="cta__arrow" viewBox="0 0 14 14" aria-hidden="true"><path d="M2.5 7h8.4M7.4 3.3 11.1 7l-3.7 3.7"/></svg>
        </a>
      </footer>
    </article>
    <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.

43 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 “Services toggle card” 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 warm #e9e6e1 paper sits a light card with fine grain, edges that catch the light and a soft three layer shadow. At the top the Ardent & Axis mark (a terracotta arc over an axis) and the switch: a sunken track with an inner shadow, two words, Heart and Reason, and a glossy white knob under Heart. Below, a real photo of two pairs of hands shaping red clay on a wheel, the name of the work at the bottom (‘Clayhouse, 2026’) and at the top right a frosted glass chip: ‘Button contrast 5.0:1 AA’, with a thin track and a pin. Then the serif italic title ‘Brands people fall for, slowly.’, three services with a hand drawn tick and their length (Naming and voice, Art direction, Spaces and events), and at the bottom ‘Engagements from $24k / 6 weeks’ next to the terracotta ‘Start a project’ button with its arrow. After three seconds the switch calls: the knob jumps toward Reason by 40 % of its width, comes back, bounces off its stop at 20 %, then 10 %, and settles; the word Reason leans toward it a hair. Meanwhile a coral glow breathes around the track, from 40 to 50 pixels in three seconds. Every five seconds the call comes again, for twenty four seconds, or until someone touches it: then the glow nearly goes out. On hover the knob leans 6 % toward the other word; pressed, it squashes and its shadow tightens; let go, it runs to the other side on a spring, stretching as it goes and landing one pixel too far. The card changes tone in a second: the paper turns cool grey, the ink blacker, the coral cobalt blue; the photo of a concrete wall against the sky wipes in from the right, from a 1.14 zoom, while the old one slides away; the title leaves upward line by line and the new one, ‘Positioning that holds its ground.’, rises in a wide sans; the service rows leave and come back in a cascade a tenth of a second apart, with the ticks drawing again; the fee rolls to $18k and the weeks to 4, one column after the other, always forward. In the chip the contrast ratio is worked out again at every frame while the colours mix: halfway the button's words switch from dark to white by themselves, and the grade climbs to AAA (7.5:1). Left alone, the demo plays by itself again and again.

How it works

A spring that bounces on its stop

The site draws the nudge by hand in CSS keyframes (40 %, 8, 20, 4, 10, 2, 0 in the first fifth of a 5 s cycle). Here it is a real spring: a kick of speed toward the other side, a spring pulling it back to zero with a bounce every 0.3 s, and a stop: when the knob crosses it, place and speed flip and lose half (BOUNCE 0.5), so the peaks come out as 40, 20, 10 on their own. Integrated in 1/240 s steps inside gsap.ticker.

Three more springs on the same knob

The run from one side to the other (STIFFNESS and DAMPING), the 6 % lean on hover and the press that takes the scale to 0.93: three springs added into one transform. The stretch comes from the speed of the run: the knob widens and flattens by half as much, then turns round again.

The call on a timer, then quiet

A GSAP timeline calls kick() at 3 s, then every 5 s for 24 s, like the site's CSS animation (3 s delay, 5 s long, over after 24 s). At the first real touch (a pointerdown with isTrusted, or a keyboard click) the timeline stops for good and the glow drops to 25 %. The glow is a CSS keyframe from 0 0 40px to 0 0 50px 5px over 3 s, alternate, in the colour of the current tone.

Mixed colours and a contrast worked out

A single number, tone.t, goes from 0 to 1: at every frame paper, ink, grey and accent of the two tones are mixed and written into CSS variables. Then the WCAG relative luminance of the accent is worked out with its ratio against white and against the ink: the higher wins and becomes the colour of the button's words, and its value goes into the chip with its grade (AAA from 7, AA from 4.5, AA Large from 3) and into the pin, at min((r−1)/20, 1), the site's own formula.

The cascade swap

As on the site, the old things leave with power2.in in 0.5 s and the new ones arrive with power2.out in 0.7 s, 0.1 s apart: the title lines inside a mask, the service rows with a touch of back.out, the ticks drawn again with stroke-dashoffset. The new photo comes in with a clip-path from the side the knob went to, expo.inOut. The fee digits are reels holding two runs of 0-9, so they always roll forward, 0.03 s between columns, and each reel takes the width of its digit.

Values to change

NameFileDefaultWhat it changes
LEFTscript.js'Heart'The word on the left of the switch.
RIGHTscript.js'Reason'The word on the right.
NUDGEscript.js0.4How far each call kicks the knob, as a share of its width (the site uses 40 %).
BOUNCEscript.js0.5How much is left after each bounce on the stop: 0.5 halves it, 40, 20, 10.
CALL_AFTERscript.js3Seconds before the first call.
CALL_EVERYscript.js5Seconds between calls.
CALL_FORscript.js24For how many seconds it calls, then it stays quiet.
STIFFNESSscript.js420The spring that carries the knob across: higher is quicker.
DAMPINGscript.js30Lower lets the knob overshoot more before it lands.
CASCADEscript.js0.1Seconds between one row and the next when the contents swap.
FEE_HEARTscript.js24The fee on the Heart side, in thousands of dollars.
FEE_REASONscript.js18The fee on the Reason side.
LOOPscript.jstrueLeft alone, the card plays by itself again and again.

Try them in the Playground

When to use it

For the services page of an agency or creative studio, a theme or mode switch in a product, two sides of an offer (feeling and figures, personal and business): when a switch has to get noticed without a line saying ‘click me’, and the change should be felt across the whole card.

On phones

The same animation with adapted sizes: the card takes almost the whole width, the photo, title, rows and button get shorter with the screen's height, the contrast chip narrows. You tap with your finger: no hover lean, the press and the spring stay the same.

With reduced motion

No kicks and no springs: the knob jumps to its place, the glow stays still, the colours fade in 0.4 s (the contrast is still worked out), photo, title, services and digits change with a fade.

Pitfalls

  • A linear spring swings around its zero and goes to the other side too: to keep all the peaks on one side, like 40, 20, 10, you need a stop that flips place and speed, not stronger damping.
  • The calls must stop only for a real touch: the internal pilot must not count as ‘touched’, so the check is on event.isTrusted and the pilot calls flip() directly.
  • The colour of the button's words changes halfway through the mix, in a single frame: without a small opacity return the jump looks hard.
  • The digit reel holds two runs of 0-9: to always roll forward, when the new digit is smaller it goes to the one in the second run and at the end a set brings it back to the first, where it looks the same.
  • Digit widths are measured after document.fonts.ready: measured earlier, with the fallback font, the reels stay too wide or get cut.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0, Newsreader (font variabile) 5.3.0.

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

Testing

Tested on 6 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