I'm having a hard time understanding this code below:
<p style="text-align: center">
<img src="http://nobacks.com/wp-content/uploads/2014/11/Cat-44-490x500.png" style="position: relative">
</p>
<script>
let cat = document.querySelector("img");
let angle = Math.PI / 2;
function animate(time, lastTime) {
if (lastTime != null) {
angle += (time - lastTime) * 0.001;
}
cat.style.top = (Math.sin(angle) * 20) + "px";
cat.style.left = (Math.cos(angle) * 200) + "px";
requestAnimationFrame(newTime => animate(newTime, time));
}
requestAnimationFrame(animate);
</script>
The outcome is a cat picture spinning in circles. My confusion comes from this part:
requestAnimationFrame(newTime => animate(newTime, time));
What does newTime => animate(newTime, time)
do?