const { camera, create, animate } = init()
camera.position.set(0, 0, 2)
create.pointLight({
position: [0, 0, 2],
});
const cube = create.cube()
animate(({ delta }) => {
cube.rotation.x += delta;
cube.rotation.y += delta;
});
intensity で光量を変化させることができます。
const { camera, create, animate } = init()
camera.position.set(0, 0, 2)
const pointLight = create.pointLight({
position: [0, 0, 2],
});
const cube = create.cube()
animate(({ delta, time }) => {
cube.rotation.x += delta;
cube.rotation.y += delta;
pointLight.intensity = Math.sin(time) * 1 + 1;
});
ヘルパーを利用することで、ライトの位置を視覚的に確認することができます。
ヘルパーのサイズは helper で指定できます。
ヘルパーの色は helperColor で指定できます。
const { camera, create, animate } = init()
camera.position.set(0, 0, 2);
const pointLight = create.pointLight({
position: [0, 0, 1],
helper: 0.1,
helperColor: 0xff0000,
});
const cube = create.cube();
animate(({ delta, time }) => {
cube.rotation.x += delta;
cube.rotation.y += delta;
pointLight.position.set(
Math.sin(time),
0,
Math.cos(time)
)
});