blob: 38598e1d3475d09e6bdbb08d677e75f6c7c87d1b (
plain)
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
|
var rfa = null;
if (window.requestAnimationFrame) {
rfa = requestAnimationFrame;
} else if (window.webkitRequestAnimationFrame) {
rfa = webkitRequestAnimationFrame;
} else if (window.msRequestAnimationFrame) {
rfa = msRequestAnimationFrame;
} else if (window.oRequestAnimationFrame) {
rfa = oRequestAnimationFrame;
}
function animate(params, count) {
rfa(function() {
animateStep(params, count);
});
}
function animateStep(params, count) {
if (!count) {
document.documentElement.removeAttribute("class");
return;
}
var rel = document.getElementById("rel");
for (prop in params) {
rel.style[prop] = (parseInt(rel.style[prop]) + params[prop]) + "px";
}
rfa(function() {
animateStep(params, count - 10);
});
}
|