Skip to content

textmode.js / Textmodifier / ambientLight

Method: ambientLight()

Call Signature

ts
ambientLight(gray): void;

Add an ambient light using a grayscale value.

Ambient light shines evenly from all directions. Multiple calls are additive, so colors accumulate. Ambient lights are frame-scoped and reset each layer draw callback. Lighting uses RGB only, so any provided alpha value is ignored.

Parameters

ParameterTypeDescription
graynumberGrayscale value (0-255)

Returns

void

Example

Call Signature

ts
ambientLight(gray, alpha): void;

Add an ambient light using a grayscale value and alpha.

Parameters

ParameterTypeDescription
graynumberGrayscale value (0-255)
alphanumberAlpha value (0-255)

Returns

void

Call Signature

ts
ambientLight(
   v1, 
   v2, 
   v3): void;

Add an ambient light using RGB components.

Parameters

ParameterTypeDescription
v1numberRed component (0-255)
v2numberGreen component (0-255)
v3numberBlue component (0-255)

Returns

void

Call Signature

ts
ambientLight(
   v1, 
   v2, 
   v3, 
   alpha): void;

Add an ambient light using RGB components and alpha.

Parameters

ParameterTypeDescription
v1numberRed component (0-255)
v2numberGreen component (0-255)
v3numberBlue component (0-255)
alphanumberAlpha value (0-255)

Returns

void

Call Signature

ts
ambientLight(color): void;

Add an ambient light using a color value.

Parameters

ParameterTypeDescription
color| string | [number, number, number] | [number, number, number, number] | TextmodeColorColor value (CSS string, TextmodeColor, or RGB(A) array)

Returns

void