Class: Light
WebSG.Light
The Light class represents a light source in a scene.
Table of contents
Constructors
Accessors
Constructors
constructor
• new Light(props
)
Creates a new Light instance.
Parameters
Name | Type | Description |
---|---|---|
props | LightProps | The properties to create the light with. |
Defined in
Accessors
color
• get
color(): RGB
Returns the color of the Light object as an RGB instance.
Example
ts
const light = world.createLight({ type: LightType.Point, color: [1, 0, 0] });
console.log(light.color); // RGB { r: 1, g: 0, b: 0 }
Returns
Defined in
intensity
• get
intensity(): number
Returns the intensity of the Light object.
Example
ts
const light = world.createLight({ type: LightType.Point });
console.log(light.intensity); // 1
Returns
number
Defined in
• set
intensity(value
): void
Sets the intensity of the Light object.
Example
ts
const light = world.createLight({ type: LightType.Point });
light.intensity = 2;
console.log(light.intensity); // 2
Parameters
Name | Type | Description |
---|---|---|
value | number | The new intensity value for the Light object. |
Returns
void