Skip to content
party.js logoparty.js logo

ReferenceCustom effectsType

LightingFn

Adjusts a particle's color for lighting.

type LightingFn = (color: Readonly<Color>, coefficient: number) => Color;

A function that adjusts a particle’s color to account for lighting, called for every particle on every frame.

It receives the particle’s color and how directly its face points towards the light, from -1 to 1, with 0 meaning edge-on. It must return a new color instance, as it should not modify the particle’s own color.

coefficientnumber