-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
29 lines (27 loc) · 910 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function draw() {
var cellClass = Array.from({length: 20}, (x,i) => "class" + i);
$(".wrap .grid").addClass("slide");
setTimeout(function(){
$(".grid .cell").removeClass(cellClass);
$(".wrap .grid").removeClass("slide");
$(".grid .cell").each(function() {
$(this).addClass("class" + Math.floor(Math.random() * 11 + 1));
});
$(".grid .cell").each(function() {
$(this)
.get(0)
.style.setProperty("--size", Math.floor(Math.random() * 2 + 1));
$(this)
.get(0)
.style.setProperty("--height", (Math.floor(Math.random() * 50) * 5) + "px");
$(this)
.get(0)
.style.setProperty("--angle", (Math.floor(Math.random() * 4) * 90) + "deg");
$(this)
.get(0)
.style.setProperty("--shift", ((Math.floor(Math.random() * 150) - 50) * 2.5) + "px");
});
}, 1600);
}
draw();
setInterval(draw, 6000);