forked from puppybits/QTransform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
executable file
·97 lines (87 loc) · 2.64 KB
/
example.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9" >
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js"></script>
<script src="qTransform.js"></script>
<meta charset=utf-8 />
<title>CSS3 Transform Prototype</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
article, aside, figure, footer, header, hgroup,
menu, nav, section { display: block; }
body { height: 800px; width: 800px; border: 1px solid red;}
#myDiv {
background-color: #FF0;
position: absolute;
padding: -80px;
width: 100px;
height: 100px;
border: 1px solid green;
hasLayout: true;
zoom: 1;
}
scaleMe {
-webkit-transform: scaleX(2);
-moz-transform: scaleX(2);
-o-transform: scaleX(2);
-ms-transform: scaleX(2);
transform: scaleX(2);
}
translateMe {
-webkit-transform: translate(200px, 200px);
-moz-transform: translate(200px, 200px);
-o-transform: translate(200px, 200px);
-ms-transform: translate(200px, 200px);
transform: translate(200px, 200px);
}
originMe {
-webkit-transform-origin: 100% 100%;
-moz-transform-origin: 100% 100%;
-o-transform-origin: 100% 100%;
-ms-transform-origin: 100% 100%;
transform-origin: 100% 100%;
}
#hold { border: 1px solid gray;}
</style>
</head>
<body>
<div id="hold">
<div id="myDiv"></div>
</div>
<div id="console"></div>
</body>
<script>
var log = function(string) {
$('#console').html(string);
}
log('center rotate');
$('#myDiv')
.css('translate', 100)
.css('rotate', -1)
.css({transformOriginX:'100%', transformOriginY:'100%'})
.css('transformOrigin', '0%,0%')
.delay(1000)
.animate({rotate: 0.28}, 900, function(){log('bottom right rotate')})
.delay(1000)
.animate({transformOriginX:'100%', transformOriginY:'100%'}, 10)
.animate({rotate: 2}, 3000, function(){log('translate')})
.animate({transformOriginX:'50%', transformOriginY:'50%'}, 1000)
.delay(1000)
.animate({translate: 200}, 1000, 'swing')
.animate({translateY: 0}, 1000)
.animate({translateX: 100}, 1000, function(){log('scale')})
.delay(1000)
.animate({scaleY: 0.3}, 2000)
.animate({scaleX: 0.1}, 2000)
.animate({scale: 1}, 500, 'swing')
.animate({rotate: -0.785}, 2000, 'swing')
.animate({scale: 1}, 500, 'swing', function(){log('add rotation and swing origin')})
.animate({rotate: '+=90deg', transformOriginX:'0%', transformOriginY:'0%'}, 3000, 'swing')
.delay(300)
.animate({rotate: '0deg', translateX: '300px', translateY:'300px'}, 2000 )
</script>
</html>