+ 1
Movement in Random Intervals
How can I make this box move in a random direction in random intervals without clicking it? https://code.sololearn.com/WzO620NuNO3U/?ref=app
2 Answers
+ 1
Using window.onload event handler and calling a function when window uploads ,
+ 1
create an interval or timeout wuth random wait time to call moveit
here's one way to do it.
function rmove(){
moveit();
setTimeout(rmove, parseInt(Math.random() * 3000));
}