-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest.html
executable file
·72 lines (65 loc) · 1.29 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<style type="text/css">
body {
margin: 0;
padding: 0;
text-align: center;
}
#screen {
width: 800px;
height: 640px;
position: relative;
background: #ccccff;
margin: 0 auto;
vertical-align: bottom
}
#inner {
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
#testBall {
background-color: blue;
width: 20px;
height: 20px;
border-radius: 10px;
margin-top: 100px;
}
</style>
<body>
<div id="screen">
<div id="inner">
<div id="testBall" style=""></div>
</div>
</div>
<script type="text/javascript" src="js/tween.js"></script>
<script type="text/javascript" src="js/animation.js"></script>
</body>
<script>
document.getElementById('testBall').onclick = function() {
var ball = this;
var time = Math.random()*5000;
var test = function() {
time = Math.random()*5000;
Math.animation(0, 800 - 20, function(value, isEnding) {
if(history.pushState) {
ball.style.transform = 'translateX(' + value + 'px)';
} else {
ball.style.left = value + 'px';
}
if(isEnding){
setTimeout(test,time)
}
}, 'Bounce.easeInOut', 1000);
}
test();
};
</script>
</html>