Have some problem.
const mesh = new THREE.Mesh(geometry,material);
let speed = 0.05;
const animate = function () {
requestAnimationFrame( animate );
mesh.rotation.x += speed;
renderer.render( scene, camera );
};
I want to gradually reduce the speed in requestAnimationFrame
speed should decrease 0.01
0.04 ,
0.03,
0.02,
0.01,
0
the only thing I came to is
but in this case it decreases mesh.rotation.x but not speed
document.addEventListener(‘click’, function () {
speed *= -1;
})
need a solution similar to speed = 0.05 -=(0.01);