-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.html
62 lines (49 loc) · 1.11 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
.wrap {
margin: 200px auto 0 auto;
width: 400px;
height: 400px;
}
.box {
width: 200px;
height: 200px;
background: #eee;
/* transform: rotate(60deg); */
/* animation: loading 3s linear; */
}
@keyframes loading {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(60deg);
}
}
</style>
<body>
<div class="wrap">
<div class="box" id="box"></div>
</div>
<button id="startBtn">点击开始</button>
<button id="endBtn">点击结束</button>
<script src="./rotate-anything.js"></script>
<script>
var startBtn = document.querySelector('#startBtn')
var endBtn = document.querySelector('#endBtn')
var rotate = rotateAnything({elemId: 'box'})
startBtn.addEventListener('click', () => {
rotate.start()
})
endBtn.addEventListener('click', () => {
rotate.end({angle: 60})
})
</script>
</body>
</html>