Skip to content

Documentation / @ripl/3d / Light

Abstract Class: Light ​

Defined in: 3d/src/core/lights.ts:103

Base class for every light, carrying the colour, intensity and enabled state they share.

A light notifies the context it belongs to whenever one of its properties changes, so a scene that is otherwise idle still repaints.

Extended by ​

Constructors ​

Constructor ​

new Light(type, options?): Light

Defined in: 3d/src/core/lights.ts:145

Parameters ​

ParameterType
typeLightType
options?LightOptions

Returns ​

Light

Properties ​

PropertyModifierTypeDescriptionDefined in
_colorprotectedstring-3d/src/core/lights.ts:108
_enabledprotectedboolean-3d/src/core/lights.ts:110
_intensityprotectednumber-3d/src/core/lights.ts:109
typereadonlyLightTypeThe kind of illumination this light contributes.3d/src/core/lights.ts:106

Accessors ​

color ​

Get Signature ​

get color(): string

Defined in: 3d/src/core/lights.ts:116

The light's colour.

Returns ​

string

Set Signature ​

set color(value): void

Defined in: 3d/src/core/lights.ts:120

Parameters ​
ParameterType
valuestring
Returns ​

void


enabled ​

Get Signature ​

get enabled(): boolean

Defined in: 3d/src/core/lights.ts:136

Whether the light contributes at all.

Returns ​

boolean

Set Signature ​

set enabled(value): void

Defined in: 3d/src/core/lights.ts:140

Parameters ​
ParameterType
valueboolean
Returns ​

void


intensity ​

Get Signature ​

get intensity(): number

Defined in: 3d/src/core/lights.ts:126

How strongly the light contributes.

Returns ​

number

Set Signature ​

set intensity(value): void

Defined in: 3d/src/core/lights.ts:130

Parameters ​
ParameterType
valuenumber
Returns ​

void

Methods ​

invalidate() ​

invalidate(): void

Defined in: 3d/src/core/lights.ts:158

Requests a repaint of whatever this light is attached to. Call after mutating derived state.

Returns ​

void