-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample.html
128 lines (79 loc) · 2.16 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
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
Example 1
Simply rotate an image
$("#img").rotate(45);
or
$("#img").rotate({angle:45});
See live example here: <a href="http://jsfiddle.net/RwEme/">http://jsfiddle.net/RwEme/</a>
Example 2
This is simple example that rotates image when user mouseover/mouseout object.
Mouseover arrow to see effect.
$("#img").rotate({
bind:
{
mouseover : function() {
$(this).rotate({animateTo:180})
},
mouseout : function() {
$(this).rotate({animateTo:0})
}
}
});
See live example here: http://jsfiddle.net/8LV3p/
Example 3
Rotate image endlessly
var angle = 0;
setInterval(function(){
angle+=3;
$("#img").rotate(angle);
},50);
See live example here: http://jsfiddle.net/73pXD/
Rotate image endlessly using recursive function
var rotation = function (){
$("#img").rotate({
angle:0,
animateTo:360,
callback: rotation
});
}
rotation();
See live example here: http://jsfiddle.net/YKj5D/
Rotate image endlessly using recursive function and custom easing (similar to example with simple endless rotation)
var rotation = function (){
$("#img").rotate({
angle:0,
animateTo:360,
callback: rotation,
easing: function (x,t,b,c,d){ // t: current time, b: begInnIng value, c: change In value, d: duration
return c*(t/d)+b;
}
});
}
rotation();
See live example here: http://jsfiddle.net/xw89p/
Example 4
Animation rotate using easing from http://gsgd.co.uk/sandbox/jquery/easing/
(remember to also include <script> contains easing)
Click on arrow to see effect.
$("#img").rotate({
bind:
{
click: function(){
$(this).rotate({ angle:0,animateTo:180,easing: $.easing.easeInOutExpo })
}
}
});
Live example here: http://jsfiddle.net/Qtb8Z/
Example 5
Animation shows how to use variables in JavaScript...
Click on arrow to see effect.
var value = 0
$("#img").rotate({
bind:
{
click: function(){
value +=90;
$(this).rotate({ animateTo:value})
}
}
});
Live example here: http://jsfiddle.net/x9ja7/