-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
35 lines (31 loc) · 1.02 KB
/
test.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<script src="js/AnimationHask.js"></script>
<body>
<div id="d"></div>
<script>
// var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
// window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
// var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
// var start = window.mozAnimationStartTime; // Only supported in FF. Other browsers can use something like Date.now().
var myReq;
var d = document.getElementById('d');
var progress = 0;
function step(timestamp) {
progress++;
d.style.left = Math.min(progress/10, 200) + "px";
console.log(progress);
console.log(myReq);
if (progress < 2000) {
myReq = requestAnimationFrame(step);
}
}
myReq = requestAnimationFrame(step);
//window.cancelAnimationFrame(myReq);
</script>
</body>
</html>