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

Exports of @dioramajs/text/ribbon.

View as Markdown
On this page
import { alphaOf, backOf, cloth } from '@dioramajs/text/ribbon'

Functions

alphaOfThe alpha of a computed CSS color, 1 when it has none: `rgb(0 0 0 / 0.5)`, `rgba(0, 0, 0, 0.5)`.
backOfThe back of the cloth: the surface (or the text) color darker, or lighter when it is dark.
clothA grid over each strip, `step` px apart (coarser past MAX_VERTICES): positions in box px, the strip's start x, length, centre y and half height, and its index for the phases.
stripsThe cloth of a style. A tinted flag or silk is the element's box; a tinted ribbon spans the box and splits its height between the lines. Without a tint the cloth is the ink with `pad` px around it: the whole text for a flag or silk, each line on its own for a ribbon.
wavesAmplitude (px) and wave number (rad/px) for cloth `length` px long: `folds` waves along it, as steep as the style allows at `wind` 1.

Constants

defaultThe heading printed on a waving 3D cloth: a flag pinned at its left edge, a ribbon that twists along its length and shows its tinted back, or silk with slow ripples and a sweeping sheen. The folds are lit by their normals and the cloth casts a soft shadow on the page. The DOM text stays for screen readers, search and selection, and shows again whenever the cloth rests flat.

Interfaces

StripA band of cloth in box px (y down): one for a flag or silk, one per line for a ribbon.

Types