Diorama

Made for a big screen.

This site is one 3D scene, built for a computer: a wide window and a mouse. Open dioramajs.dev on a desktop or a laptop to see it.This site is one 3D scene, built for a wide window. Make this one wider, or open dioramajs.dev on a larger screen.

GitHub

DioramaDocs

Curtain cover

A page transition where a panel sweeps over the old page and on off the new one, in one piece or in strips, in a color or a picture.

View as Markdown
On this page

A panel sweeps in from one edge, covers the old page while the router swaps it, and carries on out of the far edge to show the new page. Its leading edge bows while it moves and casts a soft shadow on the page. It suits studio and agency sites that brand every page change with their color, a title card or a pattern.

A dark curtain rising over the home page of a studio site, its edge bowed and casting a shadow

import { start } from '@dioramajs/diorama'
export const app = start({ transitions: { cover: 'curtain' } })

The page covers guide explains how the cover works with your router, the timing options and what visitors with reduced motion see.

Recipes

An accent ahead of the curtain

accent adds a second panel in another color. It leads the curtain in and trails it out, so the old page leaves behind a stripe of your brand color.

start({
transitions: {
cover: {
name: 'curtain',
direction: 'down',
color: '#1b1a17',
accent: '#e4572e',
curve: 0.8,
},
},
})

An orange accent panel leading a dark curtain down over a studio site

Strips

style: 'strips' cuts the curtain into count strips across its way. Each strip starts a little after the one before, so the curtain arrives as steps.

start({
transitions: {
cover: {
name: 'curtain',
style: 'strips',
direction: 'left',
count: 5,
color: '#1b1a17',
},
},
})

Five dark strips arriving from the right one after another over a studio site

A picture on the curtain

image puts a picture on the panel, cropped to fill the screen and moving with it: a title card, a pattern or a texture. It needs the assets plugin, which start() includes. If the picture fails to load, the curtain keeps its color.

start({
transitions: {
cover: {
name: 'curtain',
image: '/img/pattern.webp',
color: '#24302b',
},
},
})

Options

OptionDefaultWhat it does
style'panel'One 'panel', or 'strips' that follow one another
direction'up'Where the curtain travels: 'up', 'down', 'left' or 'right'
count5Strips of the 'strips' style
color'#0e0e10'Any CSS color
accentnoneCSS color of a second panel that leads in and trails out
imagenoneURL of a picture on the curtain
curve0.40 to 1, how far the moving edge bows; 0 is straight
shade0.40 to 1, the shadow the moving edge casts on the page

duration, ease, wait, timeout, links and arrive are shared by every cover and described in the guide.

Notes

The curtain enters from the edge opposite to direction and leaves through the edge it points to: with 'up' it rises from the bottom and goes out at the top. A click on another link while the curtain opens brings it back the way it came.