25 lines
1.1 KiB
JavaScript
25 lines
1.1 KiB
JavaScript
function draw(){
|
|
document.querySelectorAll(".row").forEach(row => {
|
|
row.style.setProperty("--shift",((Math.floor(Math.random() * 20) - 10)));
|
|
});
|
|
document.body.style.setProperty("--rotation",((Math.floor(Math.random() * 360) + 1)) + 'deg');
|
|
document.querySelectorAll(".cell").forEach(cell => {
|
|
cell.style.setProperty("--rotation",((Math.floor(Math.random() * 360) + 1)) + 'deg');
|
|
cell.style.setProperty("--shift",((Math.floor(Math.random() * 3) + 2)));
|
|
for (var i = 0; i < 10; i++) {
|
|
cell.classList.remove('class' + i);
|
|
cell.classList.remove('eye' + i);
|
|
document.body.classList.remove('color' + i);
|
|
}
|
|
document.body.classList.add('color' + ((Math.floor(Math.random() * 4) + 0)));
|
|
cell.classList.add('class' + ((Math.floor(Math.random() * 4) + 0)));
|
|
cell.classList.add('eye' + ((Math.floor(Math.random() * 10) + 0)));
|
|
});
|
|
};
|
|
|
|
draw();
|
|
|
|
document.addEventListener('click', function (event) {
|
|
document.body.classList.toggle('loading');
|
|
setTimeout(() => { draw(); document.body.classList.toggle('loading'); }, 1000);
|
|
}, false); |