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/model/box

Exports of @dioramajs/model/box.

View as Markdown
On this page
import { build, default, depthOf } from '@dioramajs/model/box'

Functions

buildThe box of a `width` × 1 front and `depth`, its faces in `faces`, bare board in `inside`. flap: the top on a hinge at its back edge; lift: a lid over the top `LID` of the box; drawer: a sleeve with a tray that slides out to the right.
depthOfDepth of the box in front heights for a front `aspect` (width over height): `depth` times the width when a number (0 is a flat card), else from the aspect of a side picture (its width is the depth), else of a top one (its height is the depth), else a third of the width.
edgeColorThe average colour of a thin strip along one edge of a picture.

Constants

defaultA product box from pictures of its faces: the front image becomes a 3D package with real proportions that turns under a drag, leans toward the pointer and can open its lid.

Interfaces

BuiltA built box: the front face at z = 0, centred in x and y, one unit tall.

Types