Line | |
---|
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
---|
2 | "http://www.w3.org/TR/html4/strict.dtd" |
---|
3 | > |
---|
4 | <html lang="en"> |
---|
5 | <head> |
---|
6 | <title>Test dojox.fx.Timeline</title> |
---|
7 | <style> |
---|
8 | @import "../../../dijit/tests/css/dijitTests.css"; |
---|
9 | body{ |
---|
10 | font-family:sans-serif; |
---|
11 | } |
---|
12 | p{ |
---|
13 | width:700px; |
---|
14 | font-size:12px; |
---|
15 | } |
---|
16 | .wrap{ |
---|
17 | |
---|
18 | } |
---|
19 | .lft{ |
---|
20 | width:500px; |
---|
21 | height:400px; |
---|
22 | border:1px solid #666; |
---|
23 | position:relative; |
---|
24 | float:left; |
---|
25 | } |
---|
26 | .rgt{ |
---|
27 | width:300px; |
---|
28 | height:400px; |
---|
29 | border:1px solid #666; |
---|
30 | position:relative; |
---|
31 | float:left; |
---|
32 | margin-left:10px; |
---|
33 | } |
---|
34 | |
---|
35 | #ball{ |
---|
36 | width:50px; |
---|
37 | height:50px; |
---|
38 | position:relative; |
---|
39 | border:1px solid #000; |
---|
40 | background:#0000ff; |
---|
41 | } |
---|
42 | |
---|
43 | #text{ |
---|
44 | font-family:sans-serif; |
---|
45 | font-size:16px; |
---|
46 | position:absolute; |
---|
47 | bottom:90%; |
---|
48 | left:0%; |
---|
49 | } |
---|
50 | </style> |
---|
51 | |
---|
52 | <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug:true, parseOnLoad: true" ></script> |
---|
53 | <script> |
---|
54 | dojo.require("dojox.fx.ext-dojo.reverse"); |
---|
55 | dojo.require("dojox.fx.Timeline"); |
---|
56 | |
---|
57 | var keys = [ |
---|
58 | { |
---|
59 | width:"50px", |
---|
60 | height:"50px", |
---|
61 | marginTop:"0px", |
---|
62 | borderWidth:"10px", |
---|
63 | borderColor:"#ffff00", |
---|
64 | left:"0px", |
---|
65 | ease:"quadIn" |
---|
66 | }, |
---|
67 | { |
---|
68 | height:"250px", |
---|
69 | marginTop:"50px", |
---|
70 | left:"300px", |
---|
71 | ease:"quadOut" |
---|
72 | }, |
---|
73 | { |
---|
74 | width:"250px", |
---|
75 | height:"50px", |
---|
76 | borderWidth:"20px", |
---|
77 | borderColor:"#ff0000", |
---|
78 | left:"0px" |
---|
79 | }, |
---|
80 | { |
---|
81 | width:"50px", |
---|
82 | height:"50px" |
---|
83 | }, |
---|
84 | { |
---|
85 | marginTop:"300px", |
---|
86 | left:"0px", |
---|
87 | ease:"bounceOut" |
---|
88 | }, |
---|
89 | { |
---|
90 | left:"300px" |
---|
91 | } |
---|
92 | ]; |
---|
93 | |
---|
94 | var keys2 = [ |
---|
95 | { |
---|
96 | step:"0%", |
---|
97 | bottom:"90%", |
---|
98 | ease:"quadIn" |
---|
99 | }, |
---|
100 | { |
---|
101 | step:"1%", |
---|
102 | left:"0%", |
---|
103 | fontSize:"36px", |
---|
104 | |
---|
105 | }, |
---|
106 | |
---|
107 | { |
---|
108 | step:"20%", |
---|
109 | bottom:"0%", |
---|
110 | ease:"quadOut" |
---|
111 | }, |
---|
112 | { |
---|
113 | step:"40%", |
---|
114 | bottom:"70%", |
---|
115 | ease:"quadIn" |
---|
116 | }, |
---|
117 | { |
---|
118 | step:"60%", |
---|
119 | bottom:"0%", |
---|
120 | ease:"quadOut" |
---|
121 | }, |
---|
122 | { |
---|
123 | step:"80%", |
---|
124 | bottom:"30%", |
---|
125 | ease:"quadIn" |
---|
126 | }, |
---|
127 | |
---|
128 | |
---|
129 | |
---|
130 | { |
---|
131 | step:"99%", |
---|
132 | fontSize:"2px", |
---|
133 | left:"90%" |
---|
134 | },{ |
---|
135 | step:"100%", |
---|
136 | bottom:"0%" |
---|
137 | } |
---|
138 | ]; |
---|
139 | |
---|
140 | var ani, ani2; |
---|
141 | reverse = function(){ |
---|
142 | ani.reverse(); |
---|
143 | ani2.reverse(); |
---|
144 | } |
---|
145 | dojo.addOnLoad(function(){ |
---|
146 | ani = dojox.fx.animateTimeline({keys:keys, duration:4000}, "ball").play(); |
---|
147 | ani2 = dojox.fx.animateTimeline({keys:keys2, duration:2000}, "text").play(); |
---|
148 | }); |
---|
149 | |
---|
150 | </script> |
---|
151 | </head> |
---|
152 | <body> |
---|
153 | <h1>Test Timeline</h1> |
---|
154 | <p> |
---|
155 | This is a test for the dojo.Animation extension, dojox.fx.Timeline. |
---|
156 | This works by replacing <em>dojo._Line</em> with <em>dojox.fx._Timeline</em>. The keyframes |
---|
157 | are an array of object properties. Properties can skip steps, so <em>width</em> will still |
---|
158 | transition if it is in key #1 and key #5. |
---|
159 | </p> |
---|
160 | <p> |
---|
161 | This is reversable as well, using <em>dojox.fx.ext-dojo.reverse</em>. Note the Reverse button. |
---|
162 | </p> |
---|
163 | <button onclick="reverse();">Reverse</button> |
---|
164 | <div class="wrap"> |
---|
165 | <div class="lft"> |
---|
166 | <div id="ball"></div> |
---|
167 | </div> |
---|
168 | <div class="rgt"> |
---|
169 | <div id="text">Dojo</div> |
---|
170 | </div> |
---|
171 | </div> |
---|
172 | </body> |
---|
173 | </html> |
---|
Note: See
TracBrowser
for help on using the repository browser.