Hello everyone, I recently started diving into Web Gl and I'm using Three js.
One of my first projects involved creating a simple rotating cube in space. Now, I want to take it a step further and add some animation to the cube. For example, I'd like it to bounce when clicked and then return to its original position. Here's a snippet of the code I've been working on for animating the cube:
function animateScene(){
xRotation += xSpeed;
yRotation += ySpeed;
cubeMesh.rotation.set(xRotation, yRotation, 0.0);
cubeMesh.position.z = zTranslation;
requestAnimationFrame(animateScene);
renderScene();
}
function renderScene(){
renderer.render(scene, camera);
}
Does anyone have any examples or tips for tweaking these parameters for different effects?