Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var l = {
- colour: 0xffffff,
- intensity: 1,
- distance: 0,
- angle: 10 * (Math.PI/180),
- penumbra: 0.8,
- decay: 1
- };
- var light = new THREE.SpotLight( l.colour, l.intensity, l.distance, l.angle, l.penumbra, l.decay);
- light.position.set(0, 0, 5);
- light.target.position.set(0, 0, 1);
- scene.add(light.target);
- scene.add(light);
- var m = { x: 0, y: 0 };
- var pos = { x: 0, y: 0 };
- window.addEventListener('mousemove', function (e) {
- m.x = e.clientX;
- m.y = e.clientY;
- pos.x = ((m.x / window.innerWidth) * 2) - 1
- pos.y = (((m.y / window.innerHeight) * 2) - 1) * -1;
- light.target.position.set( pos.x * lightZoom, pos.y * lightZoom, lightZoom );
- light.target.updateMatrixWorld();
- });
Add Comment
Please, Sign In to add comment