TransitionsPremium

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.

CSSClip-pathWipe

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

Goal replay — a handball club's score app — Diagonal Wipe example 1

① Goal replay — a handball club's score app

WhenThe fan follows the game remotely: the scoreboard (24–23) gives way to the replay of the left winger's goal.
WhyThe slanted band is the sports broadcast code: it announces "replay" and its speed matches the game's energy.
Settings512 × 256 px screen; original amber-red band; slatted court, goal area and 9 m line drawn in CSS on page B; orange "Replay the goal" button.
Next round of an office quiz — a video-call quiz app — Diagonal Wipe example 2

② Next round of an office quiz — a video-call quiz app

WhenThe round 1 standings give way to the first question of round 2, "Geography".
WhyThe slanted cut gives the sequence rhythm, like a TV game show, without being as harsh as a hard cut.
Settings378 × 332 px screen on the left, participant tiles on the right; band recolored violet to yellow (#7048e8 → #fcc419); four answers as colored tiles.
Next artist on the bill — a rap festival's giant screen — Diagonal Wipe example 3

③ Next artist on the bill — a rap festival's giant screen

WhenBetween two sets, the control room replaces the previous artist's "End of set" with the next artist's name and time.
WhyThe diagonal crosses a very wide screen fast and is visible from the back of the crowd; it matches the energy of a rap stage.
Settings480 × 200 px LED screen under a lighting truss, crowd in silhouettes; neon green to magenta band (#2bdc6a → #e64980); artist name at 44 px.

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.

Chrome 87+✓ Full
Firefox 66+✓ Full
Safari 14.1+✓ Full
Edge 87+✓ Full
Mobile iOS 14.5+✓ Full (on tap)
Android Chrome 87+✓ Full (on tap)

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):

index.html — structure
<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 / propertyDefaultEffect
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

Wipe Transition sweeps the screen horizontally with 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.
To keep the angle the same from start to finish. The leading edge goes from the top at 150% to the bottom at 100%: both points move together and the slant does not change. To enter and leave fully, the band has to start and end beyond the screen, hence the negative values or values above 100%. overflow: hidden on the screen clips what sticks out.
Yes: remove the .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).