TransitionsPremium

Circular Reveal Card

A card that is, as a whole, a two-state button: on click, the second state opens as a circle from the center and covers the first in 0.8 s; another click closes the circle. A clip-path animated in CSS, 0.7 KB of JavaScript to keep the state.

CSSJSClip-pathPremium

Updated

This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. Transitions has 52 effects, including 9 free. Explore the category →

3 usage examples

Berth switching to "taken" — a marina's pontoon map — Circular Reveal Card example 1

① Berth switching to "taken" — a marina's pontoon map

WhenA visiting sailboat ties up at pontoon B. The harbor office agent taps berth B 08 on the tablet: the light "free" tile fills with navy blue from its center and shows "Visitor, 1 night". Later the agent taps B 05, which the Fou de Bassan has just left: the circle closes.
WhyTwelve tiles packed together: the circle starting under the finger confirms which one just changed, and the solid color reads from a distance on the dock.
SettingsTwelve 80 × 80 px .crv-toggle buttons in a grid, light state A with the number, navy state B with the boat's name. Berths already taken start with crv-on, aria-pressed="true" and the aria-hidden values swapped, written in the HTML. In the capture, two real mouse clicks toggle B 08 then B 05.
Outside to inside of a tiny house — a builder's listing — Circular Reveal Card example 2

② Outside to inside of a tiny house — a builder's listing

WhenA couple looks at the Bruyère model and clicks the picture: a circle opens in the middle of the front wall and shows the inside, the bench under the large window, the loft. A second click closes the circle on the outside.
WhyBoth views share the same framing: the circle gives the feeling of looking through the wall, which a slideshow does not say.
SettingsA single 508 × 232 px .crv-toggle, 14 px rounding; each state holds a full-frame SVG illustration and a label at the bottom left (.crv-text), which also names the button. No scene script: the capture's two clicks open then close.
"Tell me when it's back" button — a wool spinning mill's online shop — Circular Reveal Card example 3

③ "Tell me when it's back" button — a wool spinning mill's online shop

WhenThe Madder red ball is sold out. A knitter presses "Tell me when it's back": the black button fills with green from its center and reads "Noted: we'll email you".
WhyOn a 46 px high button, the circle overflows the height at once and runs toward both edges: the confirmation is born where the click landed, with no dialog and no message elsewhere on the page.
Settings.crv-toggle brought down to 246 × 46 px, 10 px rounding; dark state A, green state B with a check mark drawn in CSS; 13 px labels. Another click closes the circle: in a real shop it would cancel the alert. For the capture, the scene presses the button by itself.

How it works

The .crv-toggle card is a 280 × 180 px <button> holding two stacked .crv-state layers. State A is underneath. State B is on top, but clipped by clip-path: circle(0 at 50% 50%): a zero-radius circle at the center of the card, hence invisible. Each carries its own content, an icon badge and a label in the demo.

The script only adds or removes the .crv-on class on click. CSS takes over: the circle goes to circle(100% ...) through a 0.8 s transition (cubic-bezier(.4, 0, .2, 1)), and state B shows through it. Since it is a transition and not an animation, a second click along the way heads back from the radius reached (two clicks 120 ms apart return to state A with no jump).

A 100% radius is larger than the card: on 280 × 180 px it is 235 px, while the corners sit 166 px from the center. So the circle has covered everything at 365 ms, and the remaining 435 ms happen out of view. Closing is the reverse: nothing moves on screen for the first 220 milliseconds, then the circle closes. These instants are identical in Chromium 149, Firefox 151 and WebKit 26.5 (10 px of radius at 100 ms, 132 px at 300 ms). The Customize section says how to remove that dead time.

Accessibility

  • Reduced motion: the circle is dropped (clip-path: none) and state B comes in through a 150 ms opacity fade; the toggle still works (opacity at 0.4 after 60 ms, at 1 before 320 ms).
  • Keyboard: it is a native button, so Tab reaches it (in Safari, only with the “Press Tab to highlight each item on a webpage” setting, otherwise Option + Tab), Enter and Space toggle it, without one line of script for that. 2 px purple outline on keyboard focus, offset by 3 px to stay readable on both states.
  • Screen readers: the button carries aria-pressed, and the script sets the covered state to aria-hidden. The name read is therefore always that of the state shown ("Day mode", then "Night mode" in the demo), the same one you see: a voice command such as "click Day mode" finds the button.
  • Card content: because it is a <button>, it cannot contain a link, a field or another button. Text, icons, images and SVG only.

Browser compatibility

CSS (clip-path: circle() animated by transition, inset) + 0.7 KB of JavaScript (classList.toggle). Opening, closing, reversing midway, keyboard and reduced motion give the same readings in Chromium 149, Firefox 151 and WebKit 26.5. Unprefixed clip-path needs Safari 9.1, but inset is what sets the floor: Chrome 87, Firefox 66, Safari 14.1. The slight blur behind the icon badge (backdrop-filter, written without a prefix) is only applied by Safari from version 18; before that, the badge stays a plain translucent disc.

Chrome 87+✓ Full (measured in Chromium 149)
Firefox 66+✓ Full (measured in Firefox 151)
Safari 14.1+✓ Full (measured in WebKit 26.5)
Edge 87+✓ Full (Chromium engine)
Mobile iOS 14.5+✓ Not checked on a device
Android Chrome 87+✓ Full (emulated touch)

Without JavaScript, the card stays on state A. In a browser that does not know clip-path, state B would hide state A permanently: no browser still maintained is in that case.

The code

HTML structure to paste into your page (the CSS + JS come with your purchase):

index.html — structure
<div class="crv-root">
  <button class="crv-toggle" type="button" aria-pressed="false">
    <span class="crv-state crv-state-a">
      <span class="crv-content">
        <span class="crv-icon" aria-hidden="true">…</span>
        <span class="crv-text">…</span>
      </span>
    </span>
    <span class="crv-state crv-state-b" aria-hidden="true">
      <span class="crv-content">
        <span class="crv-icon" aria-hidden="true">…</span>
        <span class="crv-text">…</span>
      </span>
    </span>
  </button>
  <span class="crv-hint" aria-hidden="true">…</span>
</div>

One-time payment, no subscription — the code is yours forever

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
Final radius (CSS — circle(100% at 50% 50%) in the .crv-on rule) 100% With 71%, the circle stops right at the corners, whatever the card's shape: opening then uses the whole duration (card covered at 735 ms instead of 365) and closing shows from 35 ms instead of 220.
Circle center (CSS — at 50% 50%, in both .crv-state-b rules) center of the card at 100% 0 starts it from the top right corner. The radius must follow: 100% no longer covers the card from a corner, 142% is needed (checked: card covered, no dead time).
Duration and curve (CSS — transition: clip-path .8s cubic-bezier(.4, 0, .2, 1)) 0.8 s 0.4 s suits a small button; beyond one second, keep a 71% radius so the wait on closing does not grow as much.
Card size (CSS — .crv-toggle { width; height; border-radius }) 280 × 180 px, 16 px rounding Radii are percentages: the card can become an 80 px tile or a 500 px picture with no other change.
Starting state (HTML — crv-on class on .crv-toggle) absent: state A is shown To start on state B, also write aria-pressed="true", aria-hidden="true" on .crv-state-a and remove it from .crv-state-b: the script only sets them on the first click.

FAQ

The same circle, two objects. Dark Mode puts a small round button in the corner of a frame: the circle starts from that button and switches two theme layers, whose content stays free (headings, links, fields). Circular Reveal Card has no separate button: the whole surface is clicked, the circle starts from the center, and the content is limited to what a button may contain. Dark Mode to change the look of a block, Circular Reveal Card for a two-state tile or button.
Because the open circle is larger than the card. At 100%, its radius is the diagonal divided by √2, that is 235 px for a 280 × 180 card whose corners are 166 px from the center. As it closes, it takes 220 ms to come back to the corners: during that time nothing is seen. Replace 100% with 71% (the exact value is 70.7%) and closing becomes visible almost at once.
Yes: call button.click() on the .crv-toggle you want. The effect's script then updates the class, aria-pressed and the aria-hidden values as for a real click. Avoid setting crv-on by hand with classList: the circle would open, but the attributes read by screen readers would stay on the old state.