createLight
@zylem/game-lib / entity / createLight
Function: createLight()
createLight(
options):ZylemLight
Defined in: packages/game-lib/src/lib/entities/light.ts:367
Create a light entity that can be added to a stage with stage.add(...).
The type discriminant narrows the accepted option keys, so TypeScript
surfaces an error if you try to set, say, angle on an ambient light.
Parameters
options
Returns
Example
stage.add(createLight({ type: 'ambient', intensity: 1.5 }));
stage.add(createLight({
type: 'directional',
position: { x: 8, y: 12, z: 6 },
target: { x: 0, y: 0, z: 0 },
castShadow: true,
}));