Diagonal Wipe
A colored band cuts the screen at an angle: it enters from the left corner, covers everything, the page changes underneath, and it leaves on the right — on the way back it runs from right to left. The only slanted wipe in the category, in clip-path: polygon(), 1.2 s, CSS + 1.6 KB of JavaScript.
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



How it works
The .diagonal-wipe-overlay band spans the .transition-preview screen, over both pages (z-index: 10): an amber to red gradient (#f59e0b → #ef4444), reduced at rest to a polygon with no area, parked off-screen on the left (polygon(-50% 0, -50% 0, -100% 100%, -100% 100%)).
On click, the band gets .animating and plays @keyframes diagonalWipe over 1.2 s ease-in-out. All four polygon points move: at 45%, the right edge goes from −50% to 150% at the top and from −100% to 100% at the bottom, so the front advances at an angle, the top half a width ahead of the bottom; from 45 to 55%, polygon(-50% 0, 150% 0, 100% 100%, -100% 100%) covers the whole screen; then the left edge catches up with the right one and the band leaves on the right. At 0.6 s, under the full band, the script toggles .is-b on .transition-preview. The points outside the box (−100%, 200%) are on purpose: they keep the angle constant during the whole crossing. On the next click, the script also sets .is-back, which plays the animation in reverse: the band enters from the right (measured 200 ms into the return: polygon(97% 0, 150% 0, 174% 100%, 47% 100%) in Chromium 151, on the same side in Firefox 153).
Once it has left on the right, the band leaves B shown until the next click. The full polygon was read at the moment of the swap in Chromium, Firefox and WebKit: no corner of A is still visible when the page changes.
Accessibility
- Reduced motion: no slanted crossing under
prefers-reduced-motion: reduce; the band stays off-screen and a 150 ms fade replaces A with B (measured: band still, B in place within 250 ms). - Keyboard and screen readers: same button as Fade Through (fx-0685), focus kept during the crossing, hidden page absent from the accessibility tree.
Browser compatibility
CSS (@keyframes on clip-path: polygon(), animation-direction, inset) + 1.6 KB of JavaScript, no dependency. Measured in Chromium 151, Firefox 153 and WebKit 26.5: full polygon at swap time, page B held, back to A on the next click with the band reversed, focus kept, direct swap under reduced motion. Unprefixed clip-path animation exists since Chrome 55, Firefox 54 and Safari 12.1; inset raises the minimums to Chrome 87, Firefox 66, Safari 14.1.
Without JavaScript, page A stays on screen and the button does nothing: provide a regular link to the next page. Without inset (Safari before 14.1), write top: 0; right: 0; bottom: 0; left: 0 on .transition-content and .transition-overlay.
The code
HTML structure to paste into your page (the CSS + JS come with your purchase):
<div class="dw-stage">
<div class="transition-preview">
<div class="transition-content old-content">Page A</div>
<div class="transition-content new-content">Page B</div>
<div class="transition-overlay diagonal-wipe-overlay"></div>
</div>
<button type="button" class="trigger-btn">Trigger Transition</button>
</div>
One-time payment, no subscription — the code is yours forever
Customize
Options passed to the API or data-* attributes:
| Option / property | Default | Effect |
|---|---|---|
Band color (CSS — .diagonal-wipe-overlay { background }) |
#f59e0b → #ef4444 gradient | The club's or the show's colors. A gradient along the cut (135deg) underlines the speed. |
| Cut angle (CSS — polygon points, 3 steps and the resting rule) | the top half a width ahead of the bottom | For a straighter cut, reduce the gap between the top and bottom points (−25% / −50% instead of −50% / −100%, and 125% / 100% on the right). Keep the same gap in every step, or the angle changes on the way. |
Duration (CSS — animation: … 1.2s; JS — SWAP_AT, END_AT) |
1.2 s; swap at 600 ms, end at 1,200 ms | Change all three together, SWAP_AT at half. 0.8 s for a snappy sports broadcast. |
Easing (CSS — ease-in-out) |
ease-in-out | cubic-bezier(.7, 0, .3, 1) stresses the acceleration in the middle, the "gust of wind" feel of opening titles. |
Content (HTML — .old-content, .new-content) |
"Page A" and "Page B" on two gradients | Any HTML, a video included: start it in .new-content on click and it appears already playing. |
FAQ
clip-path: inset() and reveals the new state directly behind a glowing line: you see A on one side of the line and B on the other during the pass. Diagonal Wipe never shows both: a solid band covers A, the swap happens underneath, the band leaves. Wipe Transition to compare two states of one interface; Diagonal Wipe for a rhythmic cut between two different screens.overflow: hidden on the screen clips what sticks out..diagonal-wipe-overlay.animating.is-back rule from the CSS, and the band will cross left to right in both directions. Reversing on the way back helps understand you are going back; a single direction suits a sequence of screens that always moves forward (rounds, artists).