@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
22 lines (21 loc) • 612 B
JavaScript
;
import { ObjectNamedFunction2 } from "./_Base";
import { isFunction } from "../../core/Type";
export class setSpotLightIntensity extends ObjectNamedFunction2 {
static type() {
return "setSpotLightIntensity";
}
func(object3D, intensity, lerp) {
let spotLight = object3D;
if (spotLight.intensity == null) {
if (isFunction(object3D.light)) {
spotLight = object3D.light();
}
}
if (spotLight.intensity == null) {
return;
}
const newIntensity = lerp * intensity + (1 - lerp) * spotLight.intensity;
spotLight.intensity = newIntensity;
}
}