Skip to main content

Function: createThreeEnvironment()

function createThreeEnvironment(scene: Scene, options?: EnvironmentDirectorOptions & ThreeEnvironmentPortOptions): ThreeEnvironmentSetup;

Defined in: threejs-environment/src/index.ts:88

Wire an environment director to a three.js scene.

The director does not tick itself - call director.update(deltaMs) from whatever already runs per frame.

const { director } = createThreeEnvironment(scene, { presets: STOCK_PRESETS });
director.transition("dusk", { durationMs: 8000, easing: "easeInOut" });
renderer.setAnimationLoop((_, __) => {
director.update(clock.getDelta() * 1000);
renderer.render(scene, camera);
});

Parameters

ParameterType
sceneScene
optionsEnvironmentDirectorOptions & ThreeEnvironmentPortOptions

Returns

ThreeEnvironmentSetup