Currently, I am embarking on my JavaScript coding journey and experimenting with Three.js as well.
I have created a scale animation for a geometry in order to achieve a subtle breathing effect using the following code:
var frame = 0;
function animate() {
requestAnimationFrame(animate);
mesh.scale.z += Math.sin(frame);
frame += 0.5;
renderer.render(scene, camera);
}
animate();
However, I've encountered an issue: When attempting to make small adjustments to the stretch of the animation, it speeds up significantly http://jsfiddle.net/ts8ssrk1/12/. On the other hand, if I slow down the animation by changing 'frame +=' to a smaller value, the geometry stretches endlessly.
Can someone provide any recommendations or solutions?