Skip to content
pixi-silk
GitHub repository
Class

Glow

import { Glow } from 'pixi-silk/glow';

A 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.

const glow = new Glow({ draw: (g) => g.circle(0, 0, 40), layers: neon(0xff3df5) });

Extends#

  • Container

Constructors#

Constructor#

new Glow(options: GlowOptions): Glow;

Parameters#

ParameterType
optionsGlowOptions

Returns#

Glow

Overrides#

Container.constructor

Accessors#

passes#

Get Signature#

get passes(): readonly SilkGraphics[];

One graphics per pass, back to front. Read-only, rebuilt by Glow.redraw.

Returns

readonly SilkGraphics[]

Methods#

redraw()#

redraw(): this;

Clears and draws every pass again. Call it when the shape drawn by draw changes. Returns this.

Returns#

this


setDraw()#

setDraw(draw: (g: SilkGraphics) => void): this;

Replaces the draw function and redraws every pass. Returns this.

Parameters#

ParameterType
draw(g: SilkGraphics) => void

Returns#

this


setLayers()#

setLayers(layers: GlowLayer[]): this;

Replaces the passes and redraws. Adds or destroys pass graphics to match the new count. Returns this.

Parameters#

ParameterType
layersGlowLayer[]

Returns#

this