TransitionsPremium

Curtain Open

Two half curtains leave the edges, meet in the middle, the page changes behind them, then they open again on the new one: a theater scene change in 1.2 s, symmetrical, animated in scaleX only — CSS + 1.5 KB of JavaScript, curtains open at rest.

CSSTransformTheatrical

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

Project elected by the youth town council — the council chamber screen — Curtain Open example 1

① Project elected by the youth town council — the council chamber screen

WhenThe show of hands is over: the screen leaves the four projects in the running (skatepark, shared garden, little free library, mural) for the elected one.
WhyThe two panels closing then opening on the result build the suspense of a show; the symmetry centers the eye on the winning project.
Settings512 × 256 px screen on white; town-blue panels (#1d2b4f to #2c4277) edged with a 3 px gold line where they meet; elected project centered at 28 px.
Switching to the finale of a runway show — a fashion school's live stream — Curtain Open example 2

② Switching to the finale of a runway show — a fashion school's live stream

WhenThe control room goes from the last look of the "Wool" collection to the finale, all students lined up.
WhyThe closing curtain marks a scene change, like backstage, without showing the moment the models take their places.
Settings512 × 276 px screen, stage lit by a gradient spotlight; charcoal felt panels (9 px stripes) with an inner shadow at the edge; silhouettes drawn in CSS.
Topic of the final round — the stage screen of a high school speech contest — Curtain Open example 3

③ Topic of the final round — the stage screen of a high school speech contest

WhenThe screen leaves the standings after the "closing argument" round for the final's set topic, which the finalists discover at the same time as the audience.
WhyThe curtain keeps the surprise: it closes on the scores and opens on the question.
SettingsRed and gold valance above the screen; red velvet panels (folds as 12, 10 and 8 px stripes); topic in 26 px serif on a dark stage background.

How it works

The curtains live in .curtain-container, a flex row laid over the whole .transition-preview screen (z-index: 10, transparent to clicks): two half-width panels, .curtain-left and .curtain-right, in a midnight-blue gradient (#1a1a2e → #0f172a). At rest, transform: scaleX(0) folds them against the edges, so page A stays fully visible (measured: 0% of the width covered in Chromium 151, Firefox 153 and WebKit 26.5).

On click, the container gets .animating; each panel plays its own 1.2 s ease-in-out animation (curtainLeft, curtainRight): scaleX(0) → 1 at 40%, held until 60%, then back to 0. transform-origin makes the symmetry: left center for the left panel, right center for the right one, so each unrolls from its edge and the two meet in the middle. Curtains closed from 0.48 s to 0.72 s; at 0.6 s, the script toggles .is-b on .transition-preview and the page changes behind them. Only transform is animated: no layout recalculation while closing.

Once open again, the curtains leave B on stage: .is-b stays set, and only the next click closes them to go back to A (in all three engines: 100% of the width covered at 0.6 s, 0% after reopening). Every rule starts from .co-stage, which avoids inheriting the .curtain-left of another component on the page, a curtain modal for instance.

Accessibility

  • Reduced motion: the curtains do not close under prefers-reduced-motion: reduce; the page changes in place with a 150 ms fade (measured: panels still, B visible in under 250 ms).
  • Keyboard and screen readers: the button is Fade Through's (fx-0685) and keeps focus while the curtains close; the curtains are empty divs and the hidden page is not read. To announce a revealed result (a vote, a topic), add aria-live="polite" on .transition-preview.

Browser compatibility

CSS (@keyframes on transform: scaleX(), transform-origin, flexbox, inset) + 1.5 KB of JavaScript, no dependency. Measured in Chromium 151, Firefox 153 and WebKit 26.5: curtains open at rest, closed at swap time, page B held, back to A on the next click, focus kept, direct swap under reduced motion. inset sets the minimum versions: 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, the curtains stay open on page A and the button does nothing: provide a regular link to the next content. Without inset (Safari before 14.1), write top: 0; right: 0; bottom: 0; left: 0 on .transition-content and .curtain-container.

The code

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

index.html — structure
<div class="co-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="curtain-container">
      <div class="curtain-left"></div>
      <div class="curtain-right"></div>
    </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
Curtain material (CSS — .curtain-left, .curtain-right { background }) #1a1a2e → #0f172a gradient Stripes (repeating-linear-gradient(90deg, #7a0f16 0 12px, #a3161f 12px 22px)) give a theater velvet; a border (border-right on the left one, border-left on the right one) marks the seam.
Duration (CSS — animation: … 1.2s on both panels; JS — SWAP_AT, END_AT) 1.2 s; swap at 600 ms, end at 1,200 ms Change all four values together, SWAP_AT at half. 1.8 s for a solemn announcement.
Time with curtains closed (CSS — 40% and 60% steps) 0.24 s 30% / 70% keeps the curtains closed for 0.48 s: the wait before the result becomes noticeable.
Opening direction (CSS — transform-origin and scaleX) horizontal, from the left and right edges For a curtain dropping from the fly loft, stack the panels (flex-direction: column, 50% height), switch to scaleY and to top center / bottom center.
Content (HTML — .old-content, .new-content) "Page A" and "Page B" on two gradients Any HTML. For a one-off reveal (a result), hide the button after the first click.

FAQ

Dialog Curtain opens a modal window: two panels slide (translateX) to reveal a dialog laid over the page. Curtain Open creates no window: it changes a screen's content in place, the curtains closing on the old one and opening on the new one. Dialog Curtain to show a message over the page; Curtain Open to replace one screen with another.
Animating width forces the browser to recompute layout on every frame; transform: scaleX() is computed separately, on the compositor, and stays smooth on a low-end screen. The flip side: a shrunk panel squashes what it contains (a pattern, some text). A velvet's vertical stripes compress with it, which looks like real fabric folding; a logo placed on the curtain would be distorted — put it on the page instead.
Write the result into .new-content before calling stage.querySelector('.trigger-btn').click(). If the computation may take more than 0.6 s, wait for it to finish before triggering: otherwise the curtains would open on an empty page. A result arriving late can also be written during the 0.24 s the curtains are closed.