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

Exports of @dioramajs/text/tunnel.

View as Markdown
On this page
import { default, FAR, gap } from '@dioramajs/text/tunnel'

Functions

gapDistance between two convex outlines on screen, px; negative when they overlap.
guidesThe guide lines as segments: from and to (x, y in units of the tunnel's half size or the helix radius, phrase step along the axis) and the line's opacity. Tunnel: the edges and two lines down each wall, and a frame every half step; spiral: two strands of the helix; zoom: none.
onScreenThe corners of a placed phrase's ink on screen, box-centre px (y up), in order around it.
paceHow fast `travel` moves at `pin`, phrases per unit of pin.
placePhrase `i` with the camera at `t`: in focus (t = i) it lies flat where the DOM has it; further back it moves onto the floor or ceiling of the tunnel or the helix, leaning towards the axis, and fades into the fog; nearer it grows, blurs and fades out before it reaches the eye. Given the phrase in focus (`focus`, the one at round(t)), a phrase behind that would cross it on screen fades out while that one holds. Undefined when unseen.
travelWhere the camera is at `pin` (0..1), in phrases: 0 on the first, `count - 1` on the last. It slows down on each phrase, so each one holds still to be read, and speeds up between them.

Constants

defaultThe phrases of a pinned section as cards in real depth: the scroll flies the camera forward through them. Each phrase comes out of the fog, holds in focus where the DOM has it, then grows, blurs and passes the viewer, along the walls of a tunnel, straight on, or around a helix. At the end of the section the last phrase settles as DOM text.
FARPhrases further behind the one in focus than this many steps are not drawn.

Interfaces

PlacedA phrase in 3D: a flat card around `centre`, along `ax` (reading direction) and `ay` (up).
RestOne phrase at rest: its ink's centre in box-centre px (y up) and half its size.
SceneThe scene: box size, phrase spacing and eye distance in px, and the look.

Types