@dioramajs/text/keycaps
Exports of @dioramajs/text/keycaps.
On this page
import { BEZEL, board, default } from '@dioramajs/text/keycaps'Functions
board | The 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. |
inks | Ink bounds of every piece from the atlas pixels; the DOM box where they cannot be read. |
rhythm | Seconds from the first key to the last, at `speed` keys a second, with a human rhythm. |
travel | Steps 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
BEZEL | Rim of the case round the keys when the case fits the keys. |
default | The 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. |
KEY | Pitch of a key per em of the text. |
LOOP | Seconds between two runs of the loop trigger. |
MAX_KEYS | Most keys drawn: past them the text stays as it is. |
SPACE | Width of a space bar. |
Interfaces
Board | The keys and the case round them. |
BoardOptions | |
Ink | Ink bounds of a piece in box px, and whether it has any. |
KeyPlan | One key of the board. |
Spring | Where a key travels: its press, 0 at rest and 1 bottomed out, and its speed. |