I need to make random smooth moving animation relative to parent. I have 3 images and i need to make them randomly moving all the time. I need to make this on vanilla js.
Any thoughts?
I googled for a long time and i found answers only on jquery or other libraries. Also i tried to write random position function
function moveElmRand(elm) {
elm.style.position = "absolute";
elm.style.top = Math.floor(Math.random() * elm.offsetWidth) + "%";
elm.style.left = Math.floor(Math.random() * elm.offsetHeight) + "%";
}
but it doesnt work.