mylingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
49 lines • 1.66 kB
JavaScript
import { SpotLight as ThreeSpotLight, SpotLightHelper } from "three";
import LightBase from "../core/LightBase";
import { spotLightDefaults, spotLightSchema } from "../../interface/ISpotLight";
export default class SpotLight extends LightBase {
static componentName = "spotLight";
static defaults = spotLightDefaults;
static schema = spotLightSchema;
constructor() {
super(ThreeSpotLight, SpotLightHelper);
this.innerY = 0;
}
get angle() {
const light = this.lightState.get();
if (!light)
return 1;
return light.angle;
}
set angle(val) {
this.cancelHandle("angle", () => this.lightState.get((light) => light && (light.angle = val)));
}
get penumbra() {
const light = this.lightState.get();
if (!light)
return 0;
return light.penumbra;
}
set penumbra(val) {
this.cancelHandle("penumbra", () => this.lightState.get((light) => light && (light.penumbra = val)));
}
get decay() {
const light = this.lightState.get();
if (!light)
return 1;
return light.decay;
}
set decay(val) {
this.cancelHandle("decay", () => this.lightState.get((light) => light && (light.decay = val)));
}
get distance() {
const light = this.lightState.get();
if (!light)
return 0;
return light.distance;
}
set distance(val) {
this.cancelHandle("distance", () => this.lightState.get((light) => light && (light.distance = val)));
}
}
//# sourceMappingURL=SpotLight.js.map