@dioramajs/text/extrude
Exports of @dioramajs/text/extrude.
import { bake, default, lamp } from '@dioramajs/text/extrude'Functions
bake | Bakes the distance from the ink along `dir` (box px, y down) up to `reach` px: 0 at the ink, 255 at `reach` or with no ink behind. Doubling: each pass takes the smaller of a pixel and the pixel `s` back plus `s`, for s = 1, 2, 4…, so log2 of the reach in canvas draws. |
lamp | The light in the frame of a face turned up by `ax` and right by `ay`: y down, z to the viewer. |
padded | The raster in a canvas with an empty margin, so its coarse mip levels end in empty texels. |
perspectiveOf | Distance of the eye for the depth, px: a gentle perspective for a box of this size. |
view | How a box of `width` x `height` px sees its depth when its face is turned up by `ax` and right by `ay` (radians): the point the depth vanishes toward, in box px (y down), and the share of the way there a point at full depth goes. At rest the back trails `depth` px away from the light at the box centre; turning the face toward a point moves the back away from it. |
Constants
default | A 3D headline: the letters get real depth, a lit block extruded from the glyphs with beveled faces and walls that darken toward the back, a stack of paper layers or a flat long shadow, seen in perspective and casting a soft shadow on the page. The block turns toward the pointer or with the scroll. The DOM text stays for screen readers, search and selection. |
MAX_LAYERS | Most paper layers. |