I’m looking to create a continuous motion for a Ball in Three.js, where it moves to the right, returns to its starting position, and then repeats the sequence.
var geometry = new THREE.SphereGeometry( 5, 32, 32);
var material = new THREE.MeshPhongMaterial( {specular: "#fdfb57",
color: "#d8d613", emissive: "#6b6a0d", side: THREE.DoubleSide} );
var ball = new THREE.Mesh(geometry, material);
var render = function () {
requestAnimationFrame( render );
renderer.render(scene, camera);
renderer.setSize(window.innerWidth, window.innerHeight);
// I'm unsure how to code the movement of the ball. Can you help?
};
render();
How can I go about implementing the movement of the ball as described?