Skip to content
pixi-silk
GitHub repository
Entry point

pixi-silk/glow

Glow, Aurora and light helpers (neon, halo, rays, spectrum).

import { Aurora, Glow, SPECTRUM, auroraBlobs } from 'pixi-silk/glow';

Classes#

ClassDescription
AuroraLight rising from the bottom of a box in three colours. The blobs blend additively, so the light burns to white where it is strongest. A mask clips it to the box. It drifts while speed is not 0 and redraws every blob each frame.
GlowA shape drawn as a stack of passes from pixi-silk/glow: blurred blooms behind, a solid core, hot highlights on top. Each pass is one child SilkGraphics, so a glow costs one draw call per pass unless batching merges them.

Interfaces#

InterfaceDescription
AuroraBlobOne soft ellipse of an Aurora at a moment in time.
AuroraOptionsOptions of Aurora.
GlowLayerOne pass of a Glow: the same shape filled or stroked once more, optionally blurred, scaled and blended additively. Stack a few and a flat shape starts to emit light.
GlowOptionsOptions of Glow.
NeonOptionsOptions of neon.
RayA straight ray from (x0, y0) to (x1, y1), w0 wide at the start and w1 at the end.

Variables#

VariableDescription
SPECTRUMThe visible spectrum, red to violet, as eight saturated 0xRRGGBB stops.

Functions#

FunctionDescription
auroraBlobspixi-silk/glow: light effects built from stacked SilkGraphics passes. Glow with the neon, halo and shadowStack recipes, an Aurora background, and helpers for rays and spectra. Not part of the root pixi-silk import.
boltAdds a lightning bolt filling the box (x, y, w, h) to g as one polygon and returns g. Fill it once and blur, spread and inner shadows treat it as a single shape.
dropAdds a drop with its tip up as one closed path and returns g. It is a circle of radius r around (cx, cy), pulled into a point tip above the centre (default 1.6 * r).
fancount rays fanning out from (x, y) around angle (radians), spread radians wide in all, each length long. Neighbouring rays touch at their ends. width is the total width at the start, shared between the rays (default 0, a point). Pair with spectrum for the colours.
haloA soft halo only, no core: rings additive passes of the shape (default 3), each wider and fainter, returned back to front. size (default 100) scales the blur and spread.
hexLabelUpper-case hex string of a colour without alpha, #FF3636 style, for swatch labels.
neonA neon glow as seven GlowLayers, back to front, for a shape about size wide. Two blooms go behind. Then come two coloured drop glows and the core, a radial gradient with a pale inner shadow. A 60% white copy on top makes the middle burn towards white. A thin blurred white outline finishes it. On a dark surface the glows blend additively.
rayAdds a tapered ray to g as one polygon and returns g. Fill it afterwards, blurred for light. One shape has no seam down its diagonal when it is blurred or translucent.
rayQuadCorners of a tapered ray as a flat [x, y] list of four points: start left, start right, end right, end left.
shadowStackStacked additive shadows behind a shape, as in CSS. Each [blur, spread] pair uses the CSS blur radius, which is twice the gaussian sigma. The default stack is [8, 0], [32, 8] and [128, 32] in white at alpha 0.6.
spectrumcount colours spread evenly along SPECTRUM, interpolated in sRGB. count is rounded, at least 1.