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/device

Exports of @dioramajs/model/device.

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

Functions

buildThe device of a frame around a screen for a box of `aspect` (width over height), the screen 1 unit tall. Proportions follow the real devices: screen aspect, bezels, depth and corner radius, `radius` times as round.
coverOfCrop of a picture of `media` aspect that covers a screen of `screen` aspect: scale and offset of the UV, centred across and from the top down, as a screenshot is read.
fitOfPx per unit that fits the device in the box in its rest pose, and the shift that centres it: the corners of its parts turned by pitch and yaw, each grown by the perspective of its depth seen from `distance` px.
screenOfThe screen aspect (width over height) of a frame for a box of `aspect`: within the range of the real device, in the box's orientation for a phone or a tablet, always landscape for a laptop.

Constants

defaultA screenshot or a video in a 3D phone, tablet, laptop or browser window that leans toward the pointer.

Interfaces

BuiltA built device: its group, centred on its bounds, and its size at rest in screen heights.
KitThe materials one device is built from.

Types