Skip to content
party.js logoparty.js logo

ReferenceCustom effectsFunction

createLighting()

Creates a lighting function that brightens particles facing the light.

function createLighting(options?: CreateLightingOptions): LightingFn;

Creates a LightingFn that scales a color’s lightness by how directly the particle faces the light, from both sides alike.

The lightness of a particle is multiplied by a value from options.ambient to options.peak, which is calculated via interpolation by the lighting coefficient.

optionsoptionalCreateLightingOptions

The ambient and peak lightness factors.