+ 9

What is use of math.random and loop in animation

How to make an animation by math.random and loop Please give me some examples and teach me by code.

2nd Mar 2021, 4:57 PM
code_creator1
code_creator1 - avatar
2 Antworten
2nd Mar 2021, 5:31 PM
Nor'wester 🌪️ 🇧🇩 (INACTIVE)
Nor'wester 🌪️ 🇧🇩 (INACTIVE) - avatar
+ 6
you cannot make an animation with a simple loop... you need to cyclicly update display in a kind of loop, by regularly but async call function(s) to do the (frame) update (using setInterval, setTimeout or requestAnimationFrame) Math.random is a function wich return a number between [0; 1[ so it's used to generate random values wich could be used inside animation ^^
2nd Mar 2021, 5:06 PM
visph
visph - avatar