Skip to main content

Fog

OBR.scene.fog

Interact with the base fog settings for this scene.

Reference

Methods

getColor

async getColor()

Get the color of the scenes fog.

Returns a string.


setColor

async setColor(color)

Set the color of the scenes fog.

Parameters

NAMETYPEDESCRIPTION
colorstringThe new color of the fog

getStrokeWidth

async getStrokeWidth()

Get the stroke width of the scenes fog.

Returns a number.


setStrokeWidth

async setStrokeWidth(width)

Set the stroke width of the scenes fog.

Parameters

NAMETYPEDESCRIPTION
widthnumberThe new width fog stroke

getFilled

async getFilled()

Returns true if the scene if filled with fog.


setFilled

async setFilled(filled)

Set the filled state of the scenes fog.

Parameters

NAMETYPEDESCRIPTION
filledbooleanThe new filled state of the fog

onChange

onChange(callback);

Parameters

NAMETYPEDESCRIPTION
callback(fog: Fog) => voidA callback for when the fog changes

Returns a function that when called will unsubscribe from change events.

Example

/**
* Use an `onChange` event with a React `useEffect`.
* `onChange` returns an unsubscribe event to make this easy.
*/
useEffect(
() =>
OBR.scene.fog.onChange((fog) => {
// React to fog changes
}),
[]
);

Type Definitions

Fog

The fog state for a scene.

TYPE
object

Properties

NAMETYPEDESCRIPTION
filledbooleanIs the fog filling the scene
styleFogStyleThe style of the fog

FogStyle

TYPE
object

Properties

NAMETYPEDESCRIPTION
colorstringThe color of the fog
strokeWidthnumberAn optional width of the fog stroke