Skip to content
pixi-silk
GitHub repository
Entry point

pixi-silk/glass

Glass: a frosted pane that blurs and bends what is behind it.

import { Glass, GlassFilter, lightVector, resolveGlass } from 'pixi-silk/glass';

Classes#

ClassDescription
GlassA pane of frosted glass from pixi-silk/glass. It blurs and bends whatever is drawn behind it, splits colours at its curved rim, and catches light on the edge that faces the light.
GlassFilterThe frosted glass filter behind Glass. Prefer Glass: it sizes the filter, keeps it in step with the transform and turns on the WebGL back buffer the filter needs.

Interfaces#

InterfaceDescription
GlassOptionsOptions of Glass: the pane size plus every GlassStyle field.
GlassStyleHow a Glass pane looks. Distances are in local units and scale with the pane’s transform. Every field is optional. resolveGlass fills in GLASS_DEFAULTS and clamps the ranges.
ResolvedGlassEvery GlassStyle field with defaults applied and ranges clamped. tint is straight sRGB, 0 to 1 per channel.

Variables#

VariableDescription
GLASS_DEFAULTSDefault values of GlassStyle, tuned for a pane over bright, colourful content. The tint default is white.

Functions#

FunctionDescription
lightVectorUnit vector towards the light for an angle in radians, in screen space with y pointing down.
resolveGlassFills in GLASS_DEFAULTS and clamps each field to its range. Returns a new object every call.