Skip to content

SpotLight:聚光灯(手电筒/舞台灯)

SpotLight 产生一个锥形光束,适合做舞台灯、车灯、手电筒等“有明显光束边界”的效果。

基本用法

ts
const light = new THREE.SpotLight(0xffffff, 30, 30, Math.PI / 6, 0.2, 2);
light.position.set(3, 6, 3);
light.target.position.set(0, 0, 0);
scene.add(light);
scene.add(light.target);

常用属性:

  • angle:光束角度(弧度)
  • penumbra:半影(边缘柔化)
  • distance/decay:范围与衰减

辅助工具

ts
scene.add(new THREE.SpotLightHelper(light));

SpotLightHelper 在你改变 angle/target 后通常需要 helper.update()