How can I make the number stop increasing when the variable num
reaches a whole number? Currently, it increments by 0.01 before pausing again. This logic is executed every frame using requestAnimationFrame
.
if (Math.floor(num * 100) / 100 == Math.floor(num) && pause < 50) {
pause += 1;
} else {
pause = 0;
num += 0.01;
}
To see the full code block, visit:
https://github.com/BootLegAidan/Geometrical-Thing/blob/master/Update.js