Hello! I have created an animation through an unorthodox method of updating the position of an object from X,Y,Z values received in a CSV file and looped until reaching the end of the CSV. How would I be able to implement a feature for this animation to play at half or 3/4 speed?
Sorry here is the main function used to animate!
function animate() {
requestAnimationFrame(animate);
if (dataIndex < convertedData.length && paused == false) {
console.log(convertedData[dataIndex]);
soccerBall.position.x = convertedData[dataIndex].x;
soccerBall.position.y = convertedData[dataIndex].y;
soccerBall.position.z = convertedData[dataIndex].z;
soccerBall.rotation.y += 1;
soccerBall.rotation.z += 1;
if (trailsEnabled == true){
trailMesh = new THREE.Mesh(trailGeometry,trailMaterial);
trailMesh.rotateX(1.5708);
trailMesh.position.x = convertedData[dataIndex].x;
trailMesh.position.y = convertedData[dataIndex].y;
trailMesh.position.z = convertedData[dataIndex].z-50;
trailObjects.push(trailMesh);
scene.add(trailMesh);
}
dataIndex++;
}```
Check this example, the animation method has a time param.
function animation( time ) {
mesh.rotation.x = time / 2000;
mesh.rotation.y = time / 1000;
renderer.render( scene, camera );
}
You can do the same with your method, tweak it till you get the desired speed.