I'm currently studying the ins and outs of javascript and Three.js but I'm struggling to grasp the concept of how the requestAnimationFrame function operates. Could someone please break down the following code in simple terms for me?
( feel free to view the complete code on jsfiddle )
// loop function
function render(time) {
time *= 0.001; // conversion to seconds
cube.rotation.x = time;
cube.rotation.y = time;
// rendering the scene
renderer.render(scene, camera);
requestAnimationFrame(render);
}
requestAnimationFrame(render);