Skip to content
animorio
IT
Back to the library

Button circle transition

TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 6.7 KBGSAP 28 KBFreeDownload the zip

A page transition for the site of a meeting notes app, with three pages in close colours: light, almost black and lilac. Every button or menu link opens the new page with a circle that starts exactly where it was pressed and grows until it covers everything, while the things of the new page come out from the centre of the circle, the nearest first, and the old page steps back a little. Going back, the circle closes again towards the button it came from.

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>
<!--
  "Button circle transition" 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 page transition with a circle from the button</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>
    <!-- three pages of a made-up notes app. Every link or button that goes to another page opens it with a circle that
         starts exactly where it was pressed; Back closes the circle again towards the button it came from -->

    <section class="page page--product" data-page="product" aria-label="Product">
      <header class="nav">
        <span class="brand" data-in><svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true"><path d="M4 15.5V4.5l12 11V4.5"></path></svg>Ondara</span>
        <nav class="nav__links" data-in>
          <a href="#" class="is-here" data-go="product">Product</a>
          <a href="#" data-go="pricing">Pricing</a>
          <a href="#" data-go="about">About</a>
        </nav>
      </header>
      <div class="content">
        <p class="eyebrow" data-in>Ondara 2.0 is here</p>
        <h1 class="title" data-in>Notes that write<br>themselves</h1>
        <p class="sub" data-in>Ondara listens to your meetings and turns them into tidy notes, owners and next steps before the call ends.</p>
        <div class="actions" data-in>
          <a href="#" class="btn btn--solid" data-go="pricing">See pricing<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9.5M8.5 4l4 4-4 4"></path></svg></a>
          <a href="#" class="btn btn--line" data-go="about">Meet the team</a>
        </div>
        <div class="shot" data-in aria-hidden="true">
          <div class="shot__bar"><i></i><i></i><i></i></div>
          <div class="shot__row"><b style="width:42%"></b><em>Owner · Lea</em></div>
          <div class="shot__row"><b style="width:64%"></b><em>Due Fri</em></div>
          <div class="shot__row"><b style="width:30%"></b><em>Done</em></div>
        </div>
      </div>
    </section>

    <section class="page page--pricing" data-page="pricing" aria-label="Pricing" hidden>
      <header class="nav">
        <a href="#" class="back" data-back data-in aria-label="Back"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M12.5 8H3.5M7.5 4l-4 4 4 4"></path></svg></a>
        <span class="brand" data-in><svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true"><path d="M4 15.5V4.5l12 11V4.5"></path></svg>Ondara</span>
        <nav class="nav__links" data-in>
          <a href="#" data-go="product">Product</a>
          <a href="#" class="is-here" data-go="pricing">Pricing</a>
          <a href="#" data-go="about">About</a>
        </nav>
      </header>
      <div class="content">
        <p class="eyebrow" data-in>Pricing</p>
        <h1 class="title" data-in>Simple, per seat</h1>
        <div class="plans">
          <article class="plan" data-in>
            <p class="plan__name">Free</p>
            <p class="plan__price"><b>$0</b><span>forever</span></p>
            <p class="plan__line">Ten meetings a month</p>
            <a href="#" class="btn btn--line btn--small" data-go="product">Start free</a>
          </article>
          <article class="plan plan--pro" data-in>
            <p class="plan__name">Pro</p>
            <p class="plan__price"><b>$12</b><span>per seat, monthly</span></p>
            <p class="plan__line">Unlimited, with action items</p>
            <a href="#" class="btn btn--solid btn--small" data-go="about">Talk to us</a>
          </article>
        </div>
      </div>
    </section>

    <section class="page page--about" data-page="about" aria-label="About" hidden>
      <header class="nav">
        <a href="#" class="back" data-back data-in aria-label="Back"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M12.5 8H3.5M7.5 4l-4 4 4 4"></path></svg></a>
        <span class="brand" data-in><svg class="brand__mark" viewBox="0 0 20 20" aria-hidden="true"><path d="M4 15.5V4.5l12 11V4.5"></path></svg>Ondara</span>
        <nav class="nav__links" data-in>
          <a href="#" data-go="product">Product</a>
          <a href="#" data-go="pricing">Pricing</a>
          <a href="#" class="is-here" data-go="about">About</a>
        </nav>
      </header>
      <div class="content">
        <p class="eyebrow" data-in>About</p>
        <h1 class="title" data-in>Six people,<br>one quiet tool</h1>
        <p class="sub" data-in>We started Ondara in 2023 because our own meeting notes never left the meeting.</p>
        <div class="team" data-in aria-hidden="true"><span>LA</span><span>TM</span><span>RS</span><span>IK</span><span>NO</span><span>PB</span></div>
        <div class="actions" data-in>
          <a href="#" class="btn btn--solid" data-go="product">Back to product</a>
        </div>
      </div>
    </section>

    <div class="ring" data-ring aria-hidden="true"></div>
    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.5l13 7.2-5.6 1.4-2.8 5.4z"></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.

58 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 “Button circle transition” 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

It is the site of Ondara, a made-up app that listens to meetings and writes their notes, with three pages. Product is light, paper coloured, with the big headline Notes that write themselves, two buttons and a small app window; Pricing is almost black, with the two plans Free and Pro; About is lilac, with the team’s six initials. Every page has the brand and the menu with the three links at the top, and the link of the current page has a soft background. Pressing a button or a menu link, the button squashes a little and comes back on a spring, then a circle with the new page inside starts from the exact point where it was pressed: it grows on a soft curve, speeding up in the middle and slowing down as it reaches the farthest corners, and a thin violet thread runs on its edge for a moment. Meanwhile the old page underneath steps back slightly and rises a few pixels, and the things of the new page (the menu, the label, the headline, the text, the buttons, the cards) fade in starting towards the centre of the circle and spreading outwards: the nearest to the pressed point first, then the farthest. On the Pricing and About pages there is a back arrow at the top left: the circle closes again towards the button it came from, the page underneath returns to its place and the one on top fades as it shrinks. On opening, the things of the first page come out from the centre the same way. A drawn pointer opens the pricing, then the team, goes back twice, opens the team again and returns to the product; if a real hand touches the page, the pointer steps aside.

How it works

Three pages on top of each other

The three pages are absolutely positioned sections, only one visible. To move to a new page it is shown above the current one with a higher z-index: the old page stays underneath until the circle has covered it completely, and only then is it hidden.

The circle in pixels

The new page is cut by a clip-path circle, written in pixels on every frame. The starting point is kept as fractions of the window and the radius is the distance to the farthest corner: so if the window changes size halfway through, the circle is recalculated and still covers everything.

Things coming out of the centre

For every thing on the new page the script measures the direction from the pressed point to its centre: it starts shifted CONTENT_PULL pixels towards the point, transparent and slightly smaller, and reaches its place with a delay that grows with the distance (up to CONTENT_STAGGER seconds). It looks as if the circle carries it along.

Back, towards the button

Every step forward is stored in a stack with the page and its starting point. The arrow removes the last step: the page underneath becomes visible and comes forward again, the one on top runs the circle in reverse, towards the same point, and is hidden at the end. Esc goes back too.

The pressed button and the thread on the edge

The button squashes to PRESS in a tenth of a second and comes back with back.out; the circle starts 0.12 seconds later, so you see the touch first and then the effect. A round div with a one and a half pixel border follows the circle’s radius and fades in the last stretch: it is the violet thread on the edge.

Values to change

NameFileDefaultWhat it changes
OPEN_TIMEscript.js0.9The seconds of the circle growing until it covers the page.
CLOSE_TIMEscript.js0.75The seconds of the circle closing towards the button when going back.
CONTENT_STAGGERscript.js0.32How long the things farthest from the pressed point wait before coming in, in seconds.
CONTENT_PULLscript.js28How many pixels towards the centre of the circle the things of the new page start from.
PAGE_PUSHscript.js0.035How far the old page steps back while the circle covers it (0 means it stays still).
PRESSscript.js0.94How much the pressed button squashes before the circle starts.
EDGEscript.js1The thin thread that runs on the edge of the circle (1 on, 0 off).

Try them in the Playground

When to use it

For the site of an app or a service with a few very different pages (the product, the pricing, the about page), when you want the page change to start from the visitor’s own click and not from an arbitrary point: a buy button opening the pricing, a menu link opening its page. It also works for switching between light and dark themes.

On phones

The same animation with adapted sizes: the circle starts from the point touched with the finger and is measured on the phone window, headlines and buttons are measured on the height too, the small app window under the headline is hidden and the two pricing plans stay side by side, narrower.

With reduced motion

No circle, no movement and no squashing buttons: the new page fades in over the old one, and going back the one on top fades out. The drawn pointer does not start.

Pitfalls

  • A clip-path in percent is not enough: the radius that covers everything depends on the corner farthest from the pressed point, so it must be computed in pixels every frame, even when the window changes size halfway through.
  • The old page must be hidden only at the end: hide it at once and the circle grows over the empty body.
  • With the keyboard the click has no coordinates (detail is 0): the circle must start from the centre of the link, not from the top left corner.
  • Two changes on top of each other break the stack: while the circle is moving, clicks must be ignored.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

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

Testing

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