-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_css3.html
161 lines (159 loc) · 6.99 KB
/
index_css3.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8">
<meta content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width" name="viewport">
<meta http-equiv="X-UA-Compatible" content="ie=edge, chrome=1">
<meta name="renderer" content="webkit">
<title>Hi!</title>
<style>
#box {
width: 300px;
height: 300px;
background-color: darkred;
position: relative;
z-index: -1;
margin-top: 30px;
}
</style>
</head>
<body>
<div>
项目源码:<a href="https://github.com/yangfch3/move.js">move.js</a><br>
缓动函数列表:<a href="http://easings.net/zh-cn">easings</a>
</div>
<div>
<br>
<br>
// 用法:move(element, propsObject[, duration][, fx][, compvareCallback])<br>
// move($('#box'), {opacity: 0, width:'500px'}, 10000, 'easeInOutSine', function(){console.log('done')})
</div>
<form id="dashboard">
<select name="pxProps" id="pxProps" size="1">
<option value="translateX">translateX</option>
<option value="translateY">translateY</option>
<option value="translateZ">translateZ</option>
</select>
<select name="px" id="px" size="1">
<option value="100">-100px</option>
<option value="300">100px</option>
<option value="700">300px</option>
</select>
<select name="numProps" id="numProps" size="1">
<option value="scale">scale</option>
<option value="scaleX">scaleX</option>
<option value="scaleY">scaleY</option>
<option value="scaleZ">scaleZ</option>
</select>
<select name="num" id="num" size="1">
<option value="0.5">.5</option>
<option value="0">0</option>
<option value="1">1</option>
<option value="1.5">1.5</option>
</select>
<select name="degProps" id="degProps" size="1">
<option value="rotate">rotate</option>
<option value="rotateX">rotateX</option>
<option value="rotateY">rotateY</option>
<option value="rotateZ">rotateZ</option>
<option value="skew">skew</option>
<option value="skewX">skewX</option>
<option value="skewY">skewY</option>
<option value="perspective">perspective</option>
</select>
<select name="deg" id="deg" size="1">
<option value="-30">-30</option>
<option value="60">60</option>
<option value="120">120</option>
<option value="245">245</option>
</select>
<select name="time" id="time" size="1">
<option value="400">400 ms(默认)</option>
<option value="1000">1000 ms</option>
<option value="5000">5000 ms</option>
</select>
<select name="fx" id="fx" size="1">
<option disabled>缓动函数列表见上方缓动函数列表链接 ↑</option>
<option value="linear">linear(默认)</option>
<option value="easeInQuad">easeInQuad</option>
<option value="easeOutQuad">easeOutQuad</option>
<option value="easeInOutQuad">easeInOutQuad</option>
<option value="easeInCubic">easeInCubic</option>
<option value="easeOutCubic">easeOutCubic</option>
<option value="easeInOutCubic">easeInOutCubic</option>
<option value="easeInQuart">easeInQuart</option>
<option value="easeOutQuart">easeOutQuart</option>
<option value="easeInOutQuart">easeInOutQuart</option>
<option value="easeInQuint">easeInQuint</option>
<option value="easeOutQuint">easeOutQuint</option>
<option value="easeInOutQuint">easeInOutQuint</option>
<option value="easeInSine">easeInSine</option>
<option value="easeOutSine">easeOutSine</option>
<option value="easeInOutSine">easeInOutSine</option>
<option value="easeInExpo">easeInExpo</option>
<option value="easeOutExpo">easeOutExpo</option>
<option value="easeInOutExpo">easeInOutExpo</option>
<option value="easeInCirc">easeInCirc</option>
<option value="easeOutCirc">easeOutCirc</option>
<option value="easeInOutCirc">easeInOutCirc</option>
<option value="easeInElastic">easeInElastic</option>
<option value="easeOutElastic">easeOutElastic</option>
<option value="easeInOutElastic">easeInOutElastic</option>
<option value="easeInBack">easeInBack</option>
<option value="easeOutBack">easeOutBack</option>
<option value="easeInOutBack">easeInOutBack</option>
<option value="easeInBounce">easeInBounce</option>
<option value="easeOutBounce">easeOutBounce</option>
<option value="easeInOutBounce">easeInOutBounce</option>
</select>
<input type="button" value="运行" id="trigger">
<input type="button" value="重置" id="init">
</form>
<div id="box"></div>
<script src="./move.js"></script>
<script>
var box = document.querySelector('#box');
document.querySelector('#trigger').addEventListener('click', function(e) {
var props = {};
props[document.querySelector('#pxProps').value] = document.querySelector('#px').value;
props[document.querySelector('#numProps').value] = document.querySelector('#num').value;
props[document.querySelector('#degProps').value] = document.querySelector('#deg').value;
var time = parseFloat(document.querySelector('#time').value);
var fx = document.querySelector('#fx').value;
this.disabled = true;
document.querySelector('#init').disabled = true;
var that = this;
move(box, props, time, fx, function() {
that.disabled = false;
document.querySelector('#init').disabled = false;
console.log('done!');
});
}, false);
document.querySelector('#init').addEventListener('click', function(e) {
var that = this;
this.disabled = true;
document.querySelector('#trigger').disabled = true;
move(box, {
translateX: 0,
translateY: 0,
translateZ: 0,
scale: 1,
scaleX: 1,
scaleY: 1,
scaleZ: 1,
rotate: 0,
rotateX: 0,
rotateY: 0,
rotateZ: 0,
skew: 0,
skewX: 0,
skewY: 0
}, parseFloat(document.querySelector('#time').value), document.querySelector('#fx').value, function() {
that.disabled = false;
document.querySelector('#trigger').disabled = false;
console.log('init done!')
})
})
</script>
</body>
</html>