@dioramajs/text/ribbon
Exports of @dioramajs/text/ribbon.
On this page
import { alphaOf, backOf, cloth } from '@dioramajs/text/ribbon'Functions
alphaOf | The alpha of a computed CSS color, 1 when it has none: `rgb(0 0 0 / 0.5)`, `rgba(0, 0, 0, 0.5)`. |
backOf | The back of the cloth: the surface (or the text) color darker, or lighter when it is dark. |
cloth | A 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. |
strips | The 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. |
waves | Amplitude (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
default | The 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
Strip | A band of cloth in box px (y down): one for a flag or silk, one per line for a ribbon. |