Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
0
you can use a random function to set the top and left position of the image: Math.floor(Math.random() * max) + 0; the max value should be the width (or height) of the canvas, minus the width (or height) of the image (so it doesn't escape) then you can use this function to set the image.style.top and image.style.left
8th Jan 2017, 4:33 PM
MatiasGF