-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrotation.js
26 lines (24 loc) · 869 Bytes
/
rotation.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
var looper;
var degrees = 0;
function rotateAnimation(el, speed) {
var cog1 = document.getElementById(el);
if (navigator.userAgent.match("Chrome")) {
cog1.style.webkitTransform = "rotate(" + degrees + "deg)";
} else if (navigator.userAgent.match("Firefox")) {
cog1.style.MozTransform = "rotate(" + degrees + "deg)";
} else if (navigator.userAgent.match("MSIE")) {
cog1.style.msTransform = "rotate(" + degrees + "deg)";
} else if (navigator.userAgent.match("Opera")) {
cog1.style.oTransform = "rotate(" + degrees + "deg)";
} else {
cog1.style.transform = "rotate(" + degrees + "deg)";
}
looper = setTimeout(function() {
rotateAnimation(el, speed);
}, speed);
degrees++;
if (degrees > 359) {
degrees = 1;
}
}
rotateAnimation ("rotate", 40);