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

Pixel cover

A page transition where the old page breaks into growing blocks and the new page resolves from them, at random, on a diagonal or from the click.

View as Markdown
On this page

Blocks grow from the middle of each cell of a grid until they meet and hide the old page. Once the router has swapped the page, the blocks shrink away and the new page shows through. It suits playful brands, games, music and tech sites.

Dark blocks of different sizes growing over the studio page of a site

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

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

Recipes

A mosaic of brand colors

palette adds up to three colors. Each block takes one of them or color, so the page turns into a mosaic of your palette. order: 'diagonal' sweeps it from the top left corner.

start({
transitions: {
cover: {
name: 'pixel',
order: 'diagonal',
cell: 64,
color: '#1b1a17',
palette: '#e4572e #2f6690',
},
},
})

A mosaic of dark, orange and blue blocks covering a studio site

Out from the click

order: 'origin' starts with the blocks around the link the visitor clicked and moves outward. Small cells read as a dissolve.

start({
transitions: {
cover: {
name: 'pixel',
order: 'origin',
cell: 32,
color: '#2f6690',
},
},
})

Blue blocks shrinking away from the top right corner of a studio page, the farthest still large

Options

OptionDefaultWhat it does
cell48Block size in CSS pixels
order'random'Which blocks go first: 'random', 'diagonal' or 'origin' (from the click)
color'#0e0e10'Any CSS color
palettenoneUp to three more CSS colors, separated by spaces
spread0.60 to 0.95, the share of each half over which the blocks start
seed1Another number gives another random order and colors

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

Notes

The blocks are drawn in your colors, not from the pixels of the page: a browser can’t read the pixels of HTML into the canvas without rasterizing the page first. A low spread makes the blocks start almost together; a high one makes them start one after another.