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

Exports of @dioramajs/text/keycaps.

View as Markdown
On this page
import { BEZEL, board, default } from '@dioramajs/text/keycaps'

Functions

boardThe keys of the text: a row per visual line in reading order, one key per letter, a space bar where the DOM has a space, a wider key for a legend that does not fit one. Keys are KEY em apart, smaller when the board would not fit. The case is the element's box with `fill`, otherwise a rim round the keys, aligned to the text like the text is aligned in its box.
inksInk bounds of every piece from the atlas pixels; the DOM box where they cannot be read.
rhythmSeconds from the first key to the last, at `speed` keys a second, with a human rhythm.
travelSteps a key toward `target` for `dt` seconds: a stiff spring that bottoms out hard at 1, the stem's top stopping a bounce back a little past rest. True when it hit the bottom moving.

Constants

BEZELRim of the case round the keys when the case fits the keys.
defaultThe text set on the keycaps of a mechanical keyboard in 3D: one sculpted, dished cap per letter with the legend printed on top in the text colour, a wide space bar between words, on a darker case seen in perspective with soft shadows. On view the keys go down one after another as if the word were typed, a quick press, a bounce and a flash each; under the pointer they press, a click sends one down hard. Retro beige caps or dark caps with an RGB glow. The text stays real in the DOM.
KEYPitch of a key per em of the text.
LOOPSeconds between two runs of the loop trigger.
MAX_KEYSMost keys drawn: past them the text stays as it is.
SPACEWidth of a space bar.

Interfaces

BoardThe keys and the case round them.
BoardOptions
InkInk bounds of a piece in box px, and whether it has any.
KeyPlanOne key of the board.
SpringWhere a key travels: its press, 0 at rest and 1 bottomed out, and its speed.