This repository has been archived by the owner on Jan 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
demo.html
398 lines (374 loc) · 14.3 KB
/
demo.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>minimit-anima demo and testing</title>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:600,700' rel='stylesheet' type='text/css'>
<style type="text/css">
h1, h2, h3, h4, h5, h6, p {margin:0;padding:0;}
.clearfix:before,
.clearfix:after {
display: table;
content: " ";
}
.clearfix:after {
clear: both;
}
html {
padding-bottom:40px;
}
body {
background:#ffffff;
margin:0;padding:0;
overflow-x:hidden;
}
.total {
min-width:950px;
max-width:950px;
margin:0px auto;
padding:0px 0px;
}
h1 {
display:inline-block;
padding:40px 0px 30px 20px;
font-family:'Source Sans Pro', sans-serif;
font-size:20px;
color:#626262;
margin-bottom:-20px;
font-weight:700;
}
.h1-cont {
display:block;position:relative;float:left;
margin:0px 10px;
}
.h1-cont a, .h1-cont a:visited {
color:#232323;
margin-left:20px;
font-family:'Source Sans Pro', sans-serif;
font-size:11px;
text-decoration:none;
text-transform:uppercase;
font-weight:600;
padding-bottom:1px;
border-bottom:2px solid #d8d8d8;
-webkit-transition:color 0.75s cubic-bezier(0,.63,.41,.98), border 1.6s cubic-bezier(0,.63,.41,.98);
-moz-transition:color 0.75s cubic-bezier(0,.63,.41,.98), border 1.6s cubic-bezier(0,.63,.41,.98);
-ms-transition:color 0.75s cubic-bezier(0,.63,.41,.98), border 1.6s cubic-bezier(0,.63,.41,.98);
-o-transition:color 0.75s cubic-bezier(0,.63,.41,.98), border 1.6s cubic-bezier(0,.63,.41,.98);
transition:color 0.75s cubic-bezier(0,.63,.41,.98), border 1.6s cubic-bezier(0,.63,.41,.98);
}
.h1-cont a:hover {
color:#000000;
border-bottom:2px solid #bde73c;
text-decoration:none;
}
.h1-cont a:active {
position:relative;
top:1px;
}
h2 {
padding:40px 0px 40px 20px;
font-family:'Source Sans Pro', sans-serif;
font-size:36px;
color:#95c500;
font-weight:600;
}
.h2-cont {
display:block;position:relative;float:left;
margin:30px 10px;
}
.h2-bkg {
display:block;position:absolute;z-index:-1;
background:#f4f4f4;
width:15000px;
left:-5000px;
height:100%;
}
h4 {
font-size:16px;
color:#484848;
padding:4px 0px 10px 0px;
font-family:'Source Sans Pro', sans-serif;
font-weight:600;
}
.item-cont {
display:block;position:relative;float:left;
padding:10px 20px;
background:#ffffff;
width:260px;
margin:10px 8px;
overflow:hidden;
}
.group .item-cont:nth-child(3n+1) {
clear:both;
}
.item-cont-inside {
display:block;position:relative;float:left;
width:260px;
height:130px;
margin:10px 0px;
}
.item {
position:absolute;
cursor:default;
top:50%;
left:50%;
width:40px;
height:40px;
margin:-20px 0 0 -20px;
}
.item-little {
display:table;
position:absolute;
width:40px;
height:40px;
background:#ededed;
border:1px solid #cecece;
}
.item .text {
display:table-cell;
vertical-align:middle;
text-align:center;
font-family:'Source Sans Pro', sans-serif;
font-weight:600;
font-size:11px;
color:#afafaf;
text-transform:uppercase;
}
.code {
display:block;position:relative;float:left;
}
pre {
padding:4px 6px;
font-family:Monaco, Menlo, Consolas, "Courier New", monospace, serif;
font-size:10px;
line-height:14px;
color:#333333;
display:block;
word-break:break-all;
word-wrap:break-word;
white-space:pre;
white-space:pre-wrap;
background:#f7f7f7;
border:1px solid #e3e3e3;
}
</style>
<!--[if lt IE 9]>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<!--<![endif]-->
<script src="minimit-anima.js" type="text/javascript"></script>
<script type="text/javascript">
function goAnimate(path){
path.find('.item-cont-inside').html(path.data('html'));
window.goAnimation = setTimeout(function(){path.data('code').func.apply(path.find('.item-little'));}, 100);
}
$(document).delegate('.item-cont', 'mouseenter', function(){
clearTimeout(window.goAnimation);
goAnimate($(this));
});
$(document).delegate('.item-cont', 'mouseleave', function(){
clearTimeout(window.goAnimation);
$(this).find('.item-cont-inside').html($(this).data('html'));
});
function populate(name, html, func){
var path = $('<div class="item-cont"><h4></h4><div class="item-cont-inside">' + html + '</div><pre class="code"></pre></div>');
path.find('h4').html(name);
path.data('html', html);
path.data('code', {func: func});
var m = func.toString().match(/\{([\s\S]*)\}$/);
var code = m[1];
code = code.replace(/^\s*|\s*$/g, '');
code = code.replace(/\t/g, '');
code = code.replace(/\n {4}/g, "\n");
path.find('pre').text(code);
$('.container .group:last-child').append(path);
}
function title(str){
$('.container').append('<div class="clearfix"></div><div class="h2-cont"><div class="h2-bkg"></div><h2 class="alt">' + str + '</h2></div><div class="clearfix"></div><div class="group">');
}
function groupClose(){
$('.container').append('</div>');
}
</script>
</head>
<body>
<div class="total">
<div class="h1-cont">
<h1>minimit-anima demo and testing</h1><a href="http://github.com/minimit/minimit-anima" target="_blank">github page</a><a href="http://www.minimit.com/projects/code/minimit-anima-plugin" target="_blank">plugin page</a>
</div>
<div class='container'></div>
</div>
<script type="text/javascript">
title('Parameters');
populate('Instant animation', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20, y:20});
});
populate('Duration', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20, y:20}, 400);
});
populate('Easing', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20, y:20}, 400, ".19,1,.22,1");
$(this).anima({x:0, y:0}, 400, "linear");
});
populate('Complete', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20, y:20}, 400, ".19,1,.22,1", {complete:function(){$(this).anima({x:-20, y:-20}, 400, "linear");}});
});
populate('Skip instant', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20, y:20}, 400, ".19,1,.22,1", {skipInstant:true});
});
groupClose();
title('Properties');
populate('Css', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({"padding-right":"20px", opacity:0.6}, 400);
});
populate('Translation', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({translateX:20, translateY:20}, 400); // px is default unit
$(this).anima({translateX:"0%", translateY:"0%"}, 400);
});
populate('Translation alt', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20, y:20}, 400); // px is default unit
$(this).anima({x:"0%", y:"0%"}, 400);
});
populate('Scale', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({scaleX:0.6, scaleY:0.6}, 400);
$(this).anima({scale:"1, 1"}, 400);
});
populate('Rotate', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({rotate:45}, 400); // deg is default unit
$(this).anima({rotateX:"0deg"}, 400);
});
populate('Skew', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({skewX:20, skewY:20}, 400); // deg is default unit
$(this).anima({skew:"0deg, 0deg"}, 400);
});
groupClose();
title('Utils');
populate('Stop', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20}, 400); // this get stopped
$(this).delayAnima(400).anima({y:20}, 400);
$(this).stopAnima();
});
populate('Stop and clearQueue', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20}, 400); // this get stopped
$(this).delayAnima(400).anima({y:20}, 400); // this get cleared
$(this).stopAnima(true);
});
populate('Stop and jumpToEnd', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20}, 400); // this get stopped and jumped to end
$(this).delayAnima(400).anima({y:20}, 400);
$(this).stopAnima(false, true);
});
populate('Delay', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20, y:0}, 400);
$(this).delayAnima(400).anima({x:20, y:20}, 400); // this get delayed
$(this).delayAnima(400).anima({x:0, y:20}, 400); // this get delayed
});
populate('Clear', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20}, 400);
$(this).delayAnima(400).anima({y:20}, 400); // this get cleared
$(this).clearAnima();
});
groupClose();
title('Advanced usage');
populate('Transform origin', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).css("transform-origin","0% 0%");
$(this).anima({rotate:"45deg"}, 400);
});
populate('2D and 3D', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima3d({rotateX:"100deg", rotateY:"100deg", rotateZ:"100deg"}, 400).anima2d({scale:0.6}, 400);
$(this).anima3d({rotateX:"0deg", rotateY:"0deg", rotateZ:"0deg"}, 400).anima2d({scale:1}, 400);
});
populate('Transform values no retain', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20, y:20});
$(this).anima({rotate:"40deg"}, 400);
});
populate('Transform values retain', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20, y:20});
$(this).anima({x:20, y:20, rotate:"40deg"}, 400);
});
populate('3D transform values no retain', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).css("perspective", "100px");
$(this).parent().css("perspective", "100px");
$(this).anima({perspective:"100px", rotateX:"0deg", rotateY:"0deg"});
$(this).anima({perspective:"100px", rotateX:"180deg"}, 400);
$(this).anima({perspective:"100px", rotateY:"180deg"}, 400);
});
populate('3D transform values retain', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).css("perspective", "100px");
$(this).parent().css("perspective", "100px");
$(this).anima({perspective:"100px", rotateX:"0deg", rotateY:"0deg"});
$(this).anima({perspective:"100px", rotateX:"180deg", rotateY:"0deg"}, 400);
$(this).anima({perspective:"100px", rotateX:"180deg", rotateY:"180deg"}, 400);
});
populate('Perspective origin', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).css("perspective-origin", "-20px 20px").css("perspective", "100px");
$(this).parent().css("perspective-origin", "-20px 20px").css("perspective", "100px");
$(this).anima({perspective:"100px", rotateX:"0deg", rotateY:"0deg"});
$(this).anima({perspective:"100px", rotateX:"180deg", rotateY:"0deg"}, 400);
$(this).anima({perspective:"100px", rotateX:"180deg", rotateY:"180deg"}, 400);
});
/*
// Old fix for ie10
populate('3D transform values retain', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
if(typeof document.body.style.msPerspective != "undefined"){ // ie10
$(this).anima({perspective:"100px", rotateX:"0deg", rotateY:"0deg"});
}else{
$(this).anima({perspective:"100px"});
}
if(typeof document.body.style.msPerspective != "undefined"){ // ie10
$(this).anima({perspective:"100px", rotateX:"180deg", rotateY:"0deg"}, 400);
}else{
$(this).anima({perspective:"100px", rotateX:"180deg"}, 400);
}
if(typeof document.body.style.msPerspective != "undefined"){ // ie10
$(this).anima({perspective:"100px", rotateX:"180deg", rotateY:"180deg"}, 400);
}else{
$(this).anima({perspective:"100px", rotateZ:"180deg"}, 400);
}
});
*/
/*
If ie10 do strange things with the transform, just put the starting values before on a anima with duration 10
``` javascript
if(typeof document.body.style.msPerspective != "undefined"){ // ie10
path.anima({perspective:"800px", rotateX:"0deg", rotateY:"0deg", rotateZ:"0deg", scale:"1", opacity:1}, 10); // IE10 fix
}
path.anima({perspective:"800px", rotateX:"0deg", rotateY:"90.1deg", rotateZ:"0deg", scale:"0.8", opacity:0.6}, 400, ".19,1,.22,1");
```
*/
/*
//try to animate transform-origin and perspective-origin
*/
groupClose();
title('Other tests');
populate('Chaining 0', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({rotate:"40deg"}, 400);
$(this).anima({rotate:"0deg"}, 400);
});
populate('Chaining 1', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({rotate:"40deg"});
$(this).anima({rotate:"0deg"}, 400);
});
populate('Chaining 2', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:20, y:0}, 200);
$(this).anima({x:20, y:20}, 200);
$(this).anima({x:0, y:20}, 200);
$(this).anima({x:0, y:0}, 200);
$(this).anima({x:20, y:0}, 200);
$(this).anima({x:20, y:20}, 200);
});
populate('Multiple animations', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({"padding-right":20, x:20, y:20, scaleX:0.6, scaleY:0.6, skewX:"20deg", skewY:"20deg", rotate:"45deg", opacity:0.6}, 400, ".19,1,.22,1", {complete:function(){alert("done");}});
});
populate('Starting values', '<div class="item"><div class="item-little"><div class="text">TEXT</div></div></div>', function(){
$(this).anima({x:-40, width:40});
$(this).anima({x:-40, width:120}, 400);
$(this).anima({x:40, width:40}, 400);
});
groupClose();
</script>
</body>
</html>