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

@dioramajs/text/unfold

Exports of @dioramajs/text/unfold.

View as Markdown
On this page
import { cut, default, eyeOf } from '@dioramajs/text/unfold'

Functions

cutCuts the text block for a style. `bands` 'auto' picks the cut from the text: a band per line for strips and origami (three for a single line of strips), about an em per pleat for accordion. `flaps` hangs every strip from the page instead of from the strip above, for hover.
eyeOfDistance of the eye from the paper, px: a perspective like CSS `perspective` on the box.
foldsAtThe fold of every unit at `time` s after the trigger, radians: `angle` before, 0 once open.
gapOfSeconds between neighbouring units: `stagger`, shrunk so all units start within `spread` durations.
paintThe order to paint the cuts in, back to front, for an eye at `eye` (element frame). A cut's children fold to its front: they go after it when the eye is on that side, before it otherwise. Siblings go by their height over the parent's plane, then the farthest from the eye first.
placeEvery cut of the sheet in 3D for the folds of its units (radians, 0 flat). A cut turns on its hinge towards its parent's front, carrying the cuts that hang from it.
spanOfSeconds from the trigger until the last unit lies flat.
spreadOfUnits start within this many durations at most; the pleats of an accordion nearly together.

Constants

defaultThe headline unfolds out of the page like paper: cut into strips, a zig-zag band, a card per letter or folded squares, hinged together and opened one after another in perspective, with paper backs, crease shading and soft shadows on the page. Once flat it is DOM text again.

Interfaces

CutA flat cut of the text block that folds on a hinge.
PlacedA cut placed in 3D: box point (x, y down) lands at o + ax * x - ay * y, z towards the viewer.
SheetHow the text block is cut, and the units that open one after another.

Types