-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathscreen.js
41 lines (39 loc) · 1.5 KB
/
screen.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
30
31
32
33
34
35
36
37
38
39
40
41
(function() {
function randomShape(array) {
return array[Math.floor(Math.random() * array.length)];
}
function loadingScreen() {
var cross = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/769286/cross.png";
var circle = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/769286/circle.png";
var triangle = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/769286/triangle.png";
var square = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/769286/square.png";
var elements = document.querySelectorAll(".ps-icon");
Array.prototype.forEach.call(elements, function(el, i) {
setTimeout(function() {
el.style.animation = "scaling";
el.style.animationDuration = "1s";
el.style.animationIterationCount = "1";
el.style.backgroundImage = "url(" + randomShape([triangle, square, circle, cross]) + ")";
}, i * 400);
el.style.animation = "";
el.style.animationDuration = "";
el.style.animationIterationCount = "";
});
function changeShape() {
var elements = document.querySelectorAll(".ps-icon");
Array.prototype.forEach.call(elements, function(el, i) {
setTimeout(function() {
el.style.animation = "scaling";
el.style.animationDuration = "1s";
el.style.animationIterationCount = "1";
el.style.backgroundImage = "url(" + randomShape([triangle, square, circle, cross]) + ")";
}, 100 + i * 300);
el.style.animation = "";
el.style.animationDuration = "";
el.style.animationIterationCount = "";
});
}
setInterval(changeShape, 3000);
}
loadingScreen();
})();