Light
The Default Light is a hemispherical light that is positioned at the center of the scene. You can change the colors of the light and the intensity.
light.diffuse
Set the diffuse color of the light. You have multiple options to define the color. You can pass a hex value, a color name or an array with the RGB values. If you pass random
as color, a random color will be set. If you don't pass any argument, the current color will be returned.
light.diffuse(color?: string | [r: number, g: number, b: number]): Promise<[r: number, g: number, b: number]>
js
api.light.diffuse([1, 0, 1]) // [r, g, b]
api.light.diffuse('#ff00ff') // hex
api.light.diffuse('lime') // color name
api.light.diffuse('random') // random color
js
actions: [{ name: 'light.diffuse', arg: '#f0f' }]
light.groundColor
For hemispheric lights, set or get the ground color of the light.
GET | SETlight.groundColor(color?: string | [r: number, g: number, b: number]): Promise<[r: number, g: number, b: number]>
js
api.light.groundColor('#ff00ff') // as hex value
js
actions: [{ name: 'light.groundColor', arg: 'red' }] // with color name
light.intensity
Set the intensity of the light. If no argument is provided, the current intensity will be returned.
GET | SETlight.intensity(intensity?: number): Promise<number>
js
api.light.intensity(0.5) // dim light to 50%
js
actions: [{ name: 'light.intensity', arg: 0.5 }] // dim light to 50%
light.enabled
Enable or disable the light. If no argument is provided, the current state will be returned. The result will be a boolean.
GET | SETlight.enabled(state?: boolean): Promise<boolean>
js
api.light.enabled(false) // disable light
js
actions: [{ name: 'light.enabled', arg: false }] // disable light