This repository has been archived on 2023-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
memeginx/runAway.js
2022-06-01 00:54:58 +03:00

20 lines
479 B
JavaScript

const rnd = (min, max) => {
const r = min + Math.random() * (min - max + 1);
return Math.floor(r);
}
const initRunning = (obj) => {
obj.style.position = 'absolute';
obj.style.transition = '0.09s';
obj.addEventListener('mouseover', () => {
obj.style.left = `${rnd(30, 50)}%`;
obj.style.top = `${rnd(30, 50)}%`;
});
};
const initColor = (obj) => {
setInterval(() => {
obj.style.color = '#'+(0x1000000+(Math.random())*0xffffff).toString(16).substr(1,6);
}, 100);
};