Is there a way that i have not seen to change the light intensity of directional lights on the fly? Or even ambient light?
ambientLight = new THREE.AmbientLight(0xffffff);
scene.add(ambientLight);
directionalLightL = new THREE.DirectionalLight(0xffffff, dLight, 0);
directionalLightL.position.set(dlpX, dlpY, dlpZ);
scene.add(directionalLightL);
So that is done initially to render, but how can i change just one specific lights intensity afterwards? Remove/re-add the light? Find it in the dom and change it? Something in the API i have not noticed?
To change the intensity for a DirectionalLight
, SpotLight
, PointLight
, or AmbientLight
, you just set it:
light.intensity = 0.5;
You can change the light color like so:
light.color.setHex( 0xff0000 );
See Color.js
for other ways to set a color.
three.js r.74
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With