| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
| 3 | <html> |
| 4 | <head> |
| 5 | <title>dojox.fx.flip | experimental fx add-ons for the Dojo Toolkit</title> |
| 6 | |
| 7 | <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug:true, parseOnLoad: true" ></script> |
| 8 | <style type="text/css"> |
| 9 | @import "../../../dojo/resources/dojo.css"; |
| 10 | @import "../../../dijit/themes/tundra/tundra.css"; |
| 11 | .testBox { |
| 12 | overflow:hidden; |
| 13 | font: 20px arial, sans-serif; |
| 14 | line-height:200px; |
| 15 | text-align:center; |
| 16 | width:300px; |
| 17 | height:200px; |
| 18 | } |
| 19 | .pageContainer{ |
| 20 | position:relative; |
| 21 | border:1px solid #999; |
| 22 | } |
| 23 | .page{ |
| 24 | padding:13px; |
| 25 | width:200px; |
| 26 | height:360px; |
| 27 | background:#f0ecec; |
| 28 | color:#333; |
| 29 | font:11px arial, sans-serif; |
| 30 | } |
| 31 | table.demoContainer{ |
| 32 | border-collapse: collapse; |
| 33 | margin-top:20px; |
| 34 | } |
| 35 | table.demoContainer thead th{ |
| 36 | font: 20px arial, sans-serif; |
| 37 | border-bottom:1px solid #999; |
| 38 | text-align:center; |
| 39 | color: #666; |
| 40 | } |
| 41 | table.demoContainer thead th.view{ |
| 42 | border-right:1px solid #999; |
| 43 | } |
| 44 | table.demoContainer td.view{ |
| 45 | border-right: 1px solid #999; |
| 46 | width:400px; |
| 47 | padding:10px 0px 30px 100px; |
| 48 | text-align:center; |
| 49 | } |
| 50 | div.controls{ |
| 51 | width:300px; |
| 52 | height:200px; |
| 53 | margin: 40px 20px 0 20px; |
| 54 | } |
| 55 | div.topBottom{ |
| 56 | width:100%; |
| 57 | text-align:center; |
| 58 | } |
| 59 | div.middle{ |
| 60 | margin:40px 0; |
| 61 | width:100%; |
| 62 | height:40px; |
| 63 | line-height:40px; |
| 64 | text-align:center; |
| 65 | position:relative; |
| 66 | } |
| 67 | input.button{ |
| 68 | border:1px solid #999; |
| 69 | color: #333; |
| 70 | background: #ddd; |
| 71 | padding:5px; |
| 72 | } |
| 73 | </style> |
| 74 | <script type="text/javascript"> |
| 75 | dojo.require("dojox.fx.flip"); |
| 76 | |
| 77 | |
| 78 | // fx.flip example: |
| 79 | var flipinit = function(){ |
| 80 | dojo.connect(dojo.byId("flipTop"), "onclick", function(e){ |
| 81 | var anim = dojox.fx.flip({ |
| 82 | node: "flip1", |
| 83 | dir: "top", |
| 84 | depth: .5, |
| 85 | endColor: "#666", |
| 86 | duration:400 |
| 87 | }); |
| 88 | dojo.connect(anim, "onEnd", this, function(){ |
| 89 | var n = dojo.byId("flip1"); |
| 90 | n.innerHTML = "TOP"; |
| 91 | dojo.style(n, { |
| 92 | color: "#ddd", |
| 93 | background: "#666" |
| 94 | }); |
| 95 | }) |
| 96 | anim.play(); |
| 97 | }); |
| 98 | dojo.connect(dojo.byId("flipRight"), "onclick", function(e){ |
| 99 | var anim = dojox.fx.flip({ |
| 100 | node: "flip1", |
| 101 | dir: "right", |
| 102 | depth: .5, |
| 103 | endColor: "yellow", |
| 104 | duration:400 |
| 105 | }) |
| 106 | dojo.connect(anim, "onEnd", this, function(){ |
| 107 | var n = dojo.byId("flip1"); |
| 108 | n.innerHTML = "RIGHT"; |
| 109 | dojo.style(n, { |
| 110 | color: "red", |
| 111 | background: "yellow" |
| 112 | }); |
| 113 | }) |
| 114 | anim.play(); |
| 115 | }); |
| 116 | dojo.connect(dojo.byId("flipBottom"), "onclick", function(e){ |
| 117 | var anim = dojox.fx.flip({ |
| 118 | node: "flip1", |
| 119 | dir: "bottom", |
| 120 | depth: .5, |
| 121 | endColor: "red", |
| 122 | duration: 400 |
| 123 | }) |
| 124 | dojo.connect(anim, "onEnd", this, function(){ |
| 125 | var n = dojo.byId("flip1"); |
| 126 | n.innerHTML = "BOTTOM"; |
| 127 | dojo.style(n, { |
| 128 | color: "yellow", |
| 129 | background: "red" |
| 130 | }); |
| 131 | }) |
| 132 | anim.play(); |
| 133 | }); |
| 134 | |
| 135 | dojo.connect(dojo.byId("flipLeft"), "onclick", function(e){ |
| 136 | var anim = dojox.fx.flip({ |
| 137 | node: "flip1", |
| 138 | dir: "left", |
| 139 | depth: .5, |
| 140 | endColor: "blue", |
| 141 | duration:400 |
| 142 | }); |
| 143 | |
| 144 | dojo.connect(anim, "onEnd", this, function(){ |
| 145 | var n = dojo.byId("flip1"); |
| 146 | n.innerHTML = "LEFT"; |
| 147 | dojo.style(n, { |
| 148 | color: "white", |
| 149 | background: "blue" |
| 150 | }); |
| 151 | }); |
| 152 | anim.play(); |
| 153 | }); |
| 154 | }; |
| 155 | |
| 156 | // fx.flip, half flip example: |
| 157 | var halfflipinit = function(){ |
| 158 | dojo.connect(dojo.byId("halfflipreset"), "onclick", function(){ |
| 159 | dojo.style(dojo.byId("hflip1"), { |
| 160 | visibility: "hidden" |
| 161 | }); |
| 162 | }); |
| 163 | dojo.connect(dojo.byId("halfflip"), "onclick", function(e){ |
| 164 | var anim = dojox.fx.flip({ |
| 165 | node: "hflip1", |
| 166 | dir: "top", |
| 167 | shift: -150, |
| 168 | whichAnim: "last", |
| 169 | depth: .5, |
| 170 | endColor: "#666", |
| 171 | duration: 1000 |
| 172 | }) |
| 173 | dojo.connect(anim, "onEnd", this, function(){ |
| 174 | var n = dojo.byId("hflip1"); |
| 175 | }) |
| 176 | anim.play(); |
| 177 | }); |
| 178 | }; |
| 179 | |
| 180 | // fx.flipCube example: |
| 181 | var cubeinit = function(){ |
| 182 | dojo.connect(dojo.byId("cflipTop"), "onclick", function(e){ |
| 183 | var anim = dojox.fx.flipCube({ |
| 184 | node: dojo.byId("cflip1"), |
| 185 | dir: "top", |
| 186 | endColor: "#666666", |
| 187 | duration:500 |
| 188 | }); |
| 189 | dojo.connect(anim, "onEnd", this, function(){ |
| 190 | var n = dojo.byId("cflip1"); |
| 191 | n.innerHTML = "TOP"; |
| 192 | dojo.style(n, { |
| 193 | color: "#ddd", |
| 194 | background: "#666" |
| 195 | }); |
| 196 | }); |
| 197 | anim.play(); |
| 198 | }); |
| 199 | dojo.connect(dojo.byId("cflipRight"), "onclick", function(e){ |
| 200 | var anim = dojox.fx.flipCube({ |
| 201 | node: dojo.byId("cflip1"), |
| 202 | dir: "right", |
| 203 | endColor: "yellow", |
| 204 | duration:500 |
| 205 | }); |
| 206 | dojo.connect(anim, "onEnd", this, function(){ |
| 207 | var n = dojo.byId("cflip1"); |
| 208 | n.innerHTML = "RIGHT"; |
| 209 | dojo.style(n, { |
| 210 | color: "red", |
| 211 | background: "yellow" |
| 212 | }); |
| 213 | }); |
| 214 | anim.play(); |
| 215 | }); |
| 216 | dojo.connect(dojo.byId("cflipBottom"), "onclick", function(e){ |
| 217 | var anim = dojox.fx.flipCube({ |
| 218 | node: dojo.byId("cflip1"), |
| 219 | dir: "bottom", |
| 220 | endColor: "red", |
| 221 | duration: 500 |
| 222 | }); |
| 223 | dojo.connect(anim, "onEnd", this, function(){ |
| 224 | var n = dojo.byId("cflip1"); |
| 225 | n.innerHTML = "BOTTOM"; |
| 226 | dojo.style(n, { |
| 227 | color: "yellow", |
| 228 | background: "red" |
| 229 | }); |
| 230 | }); |
| 231 | anim.play(); |
| 232 | }); |
| 233 | dojo.connect(dojo.byId("cflipLeft"), "onclick", function(e){ |
| 234 | var anim = dojox.fx.flipCube({ |
| 235 | node: "cflip1", |
| 236 | dir: "left", |
| 237 | endColor: "blue", |
| 238 | duration: 500 |
| 239 | }); |
| 240 | dojo.connect(anim, "onEnd", this, function(){ |
| 241 | var n = dojo.byId("cflip1"); |
| 242 | n.innerHTML = "LEFT"; |
| 243 | dojo.style(n, { |
| 244 | color: "white", |
| 245 | background: "blue" |
| 246 | }); |
| 247 | }); |
| 248 | anim.play(); |
| 249 | }); |
| 250 | }; |
| 251 | |
| 252 | // fx.flipGrid example: |
| 253 | var gridinit = function(){ |
| 254 | dojo.connect(dojo.byId("reset"), "onclick", function(e){ |
| 255 | dojo.byId("flipGrid").disabled = ""; |
| 256 | dojo.style(dojo.byId("gflip1"), { |
| 257 | visibility: "visible" |
| 258 | }); |
| 259 | }); |
| 260 | dojo.connect(dojo.byId("flipGrid"), "onclick", function(e){ |
| 261 | var anim = dojox.fx.flipGrid({ |
| 262 | node: dojo.byId("gflip1"), |
| 263 | dir: "right", |
| 264 | cols: 7, |
| 265 | rows: 5, |
| 266 | duration:900 |
| 267 | }); |
| 268 | dojo.connect(anim, "play", this, function(){ |
| 269 | dojo.byId("flipGrid").disabled = "disabled"; |
| 270 | }); |
| 271 | anim.play(); |
| 272 | }); |
| 273 | }; |
| 274 | |
| 275 | // fx.flipPage example: |
| 276 | var currentPage = 0, |
| 277 | pages = 4 |
| 278 | ; |
| 279 | var pageinit = function(){ |
| 280 | dojo.connect(dojo.byId("flipPageRight"), "onclick", function(e){ |
| 281 | var anim = dojox.fx.flipPage({ |
| 282 | node: dojo.byId("page" + (currentPage + 1)), |
| 283 | dir: "left", |
| 284 | endColor: "yellow", |
| 285 | depth: .3, |
| 286 | duration:3000 |
| 287 | }); |
| 288 | dojo.connect(anim, "play", this, function(){ |
| 289 | dojo.byId("page" + (currentPage + 1)).style.display = "none"; |
| 290 | dojo.byId("page" + ((currentPage + 3) % pages)).style.display = "block"; |
| 291 | }); |
| 292 | dojo.connect(anim, "onEnd", this, function(){ |
| 293 | dojo.byId("page" + currentPage).style.display = "none"; |
| 294 | dojo.byId("page" + (currentPage + 1)).style.display = "none"; |
| 295 | currentPage = (currentPage + 2) % pages; |
| 296 | dojo.byId("page" + currentPage).style.display = "block"; |
| 297 | dojo.byId("page" + (currentPage + 1)).style.display = "block"; |
| 298 | }); |
| 299 | anim.play(); |
| 300 | }); |
| 301 | dojo.connect(dojo.byId("flipPageLeft"), "onclick", function(e){ |
| 302 | var anim = dojox.fx.flipPage({ |
| 303 | node: dojo.byId("page" + currentPage), |
| 304 | dir: "right", |
| 305 | endColor: "blue", |
| 306 | depth: .3, |
| 307 | duration:3000 |
| 308 | }); |
| 309 | dojo.connect(anim, "play", this, function(){ |
| 310 | dojo.byId("page" + (currentPage) % pages).style.display = "none"; |
| 311 | dojo.byId("page" + ((currentPage + 2) % pages)).style.display = "block"; |
| 312 | }); |
| 313 | dojo.connect(anim, "onEnd", this, function(){ |
| 314 | dojo.byId("page" + currentPage).style.display = "none"; |
| 315 | dojo.byId("page" + (currentPage + 1)).style.display = "none"; |
| 316 | currentPage = (currentPage + 2) % pages; |
| 317 | dojo.byId("page" + currentPage).style.display = "block"; |
| 318 | dojo.byId("page" + (currentPage + 1)).style.display = "block"; |
| 319 | }); |
| 320 | anim.play(); |
| 321 | }); |
| 322 | }; |
| 323 | |
| 324 | dojo.ready(flipinit); |
| 325 | dojo.ready(halfflipinit); |
| 326 | dojo.ready(cubeinit); |
| 327 | dojo.ready(gridinit); |
| 328 | dojo.ready(pageinit); |
| 329 | </script> |
| 330 | </head> |
| 331 | <body class="tundra"> |
| 332 | <table class="demoContainer"> |
| 333 | <thead> |
| 334 | <tr><th class="view">dojox.fx.flip test</th><th></th></tr> |
| 335 | </thead> |
| 336 | <tbody> |
| 337 | <tr> |
| 338 | <td class="view"> |
| 339 | <div style="width:300px;height:200px;background:#666;color:#ddd;" id="flip1" class="testBox"> |
| 340 | dojox.fx.flip |
| 341 | </div> |
| 342 | </td> |
| 343 | <td> |
| 344 | <div class="controls"> |
| 345 | <div class="topBottom"><input type="button" class="button" style="margin:auto" id="flipTop" value="flip top" /></div> |
| 346 | <div class="middle"> |
| 347 | <div style="position:absolute;margin:auto;right:0;top:0"><input type="button" class="button" id="flipRight" value="flip right" /></div> |
| 348 | controls |
| 349 | <div style="position:absolute;margin:auto;left:0;top:0"><input type="button" class="button" id="flipLeft" value="flip left" /></div> |
| 350 | </div> |
| 351 | <div class="topBottom"><input type="button" class="button" id="flipBottom" value="flip bottom" /></div> |
| 352 | </div> |
| 353 | </td> |
| 354 | </tr> |
| 355 | </tbody> |
| 356 | <thead> |
| 357 | <tr><th class="view">dojox.fx.flip test - half flip</th><th></th></tr> |
| 358 | </thead> |
| 359 | <tbody> |
| 360 | <tr> |
| 361 | <td class="view"> |
| 362 | <div style="width:300px;height:200px;background:#666;color:#ddd;visibility:hidden" id="hflip1" class="testBox"> |
| 363 | WOOT! |
| 364 | </div> |
| 365 | </td> |
| 366 | <td> |
| 367 | <div class="controls"> |
| 368 | <div class="middle"> |
| 369 | <div style="position:absolute;left:60px;top:0"><input type="button" class="button" id="halfflip" value="half flip" /></div> |
| 370 | <div style="position:absolute;right:60px;top:0"><input type="button" class="button" id="halfflipreset" value="reset" /></div> |
| 371 | </div> |
| 372 | </div> |
| 373 | </td> |
| 374 | </tr> |
| 375 | </tbody> |
| 376 | <thead> |
| 377 | <tr><th class="view">dojox.fx.flipCube test</th><th></th></tr> |
| 378 | </thead> |
| 379 | <tbody> |
| 380 | <tr> |
| 381 | <td class="view"> |
| 382 | <div style="width:300px;height:200px;background:#666;color:#ddd" id="cflip1" class="testBox"> |
| 383 | dojox.fx.flipCube |
| 384 | </div> |
| 385 | </td> |
| 386 | <td> |
| 387 | <div class="controls"> |
| 388 | <div class="topBottom"><input type="button" class="button" style="margin:auto" id="cflipTop" value="flip top" /></div> |
| 389 | <div class="middle"> |
| 390 | <div style="position:absolute;margin:auto;right:0;top:0"><input type="button" class="button" id="cflipRight" value="flip right" /></div> |
| 391 | controls |
| 392 | <div style="position:absolute;margin:auto;left:0;top:0"><input type="button" class="button" id="cflipLeft" value="flip left" /></div> |
| 393 | </div> |
| 394 | <div class="topBottom"><input type="button" class="button" id="cflipBottom" value="flip bottom" /></div> |
| 395 | </div> |
| 396 | </td> |
| 397 | </tr> |
| 398 | </tbody> |
| 399 | <thead> |
| 400 | <tr><th class="view">dojox.fx.flipGrid test</th><th></th></tr> |
| 401 | </thead> |
| 402 | <tbody> |
| 403 | <tr> |
| 404 | <td class="view"> |
| 405 | <div style="width:300px;height:200px;background:#666;color:#ddd" id="gflip1" class="testBox"> |
| 406 | dojox.fx.flipGrid |
| 407 | </div> |
| 408 | <td> |
| 409 | <div class="controls"> |
| 410 | <div class="middle"> |
| 411 | <div style="position:absolute;left:60px;top:0"><input type="button" class="button" id="flipGrid" value="flip grid" /></div> |
| 412 | <div style="position:absolute;right:60px;top:0"><input type="button" class="button" id="reset" value="reset" /></div> |
| 413 | </div> |
| 414 | </div> |
| 415 | </td> |
| 416 | </tr> |
| 417 | </tbody> |
| 418 | <thead> |
| 419 | <tr><th class="view">dojox.fx.flipPage test</th><th></th></tr> |
| 420 | </thead> |
| 421 | <tbody> |
| 422 | <tr> |
| 423 | <td class="view" style="padding-left:20px"> |
| 424 | <table style="height:300px; width:400px; border-collapse:collapse"> |
| 425 | <tbody> |
| 426 | <tr> |
| 427 | <td> |
| 428 | <div id="pageContainer0" class="pageContainer"> |
| 429 | <div style="display:none" id="page2" class="page"> |
| 430 | Ed una lupa, che di tutte brame |
| 431 | sembiava carca ne la sua magrezza, |
| 432 | e molte genti fé già viver grame, |
| 433 | questa mi porse tanto di gravezza |
| 434 | con la paura ch'uscia di sua vista, |
| 435 | ch'io perdei la speranza de l'altezza. |
| 436 | E qual è quei che volontieri acquista, |
| 437 | e giugne 'l tempo che perder lo face, |
| 438 | che 'n tutt'i suoi pensier piange e s'attrista; |
| 439 | tal mi fece la bestia sanza pace, |
| 440 | che, venendomi 'ncontro, a poco a poco |
| 441 | mi ripigneva là dove 'l sol tace. |
| 442 | Mentre ch'i' rovinava in basso loco, |
| 443 | dinanzi a li occhi mi si fu offerto |
| 444 | chi per lungo silenzio parea fioco. |
| 445 | Quando vidi costui nel gran diserto, |
| 446 | «Miserere di me», gridai a lui, |
| 447 | «qual che tu sii, od ombra od omo certo!». |
| 448 | Rispuosemi: «Non omo, omo già fui, |
| 449 | e li parenti miei furon lombardi, |
| 450 | mantoani per patria ambedui. |
| 451 | Nacqui sub Iulio, ancor che fosse tardi, |
| 452 | e vissi a Roma sotto 'l buono Augusto |
| 453 | nel tempo de li dèi falsi e bugiardi. |
| 454 | Poeta fui, e cantai di quel giusto [...] |
| 455 | </div> |
| 456 | <div class="page" id="page0"> |
| 457 | Nel mezzo del cammin di nostra vita |
| 458 | mi ritrovai per una selva oscura |
| 459 | ché la diritta via era smarrita. |
| 460 | Ahi quanto a dir qual era è cosa dura |
| 461 | esta selva selvaggia e aspra e forte |
| 462 | che nel pensier rinova la paura! |
| 463 | Tant'è amara che poco è più morte; |
| 464 | ma per trattar del ben ch'i' vi trovai, |
| 465 | dirò de l'altre cose ch'i' v'ho scorte. |
| 466 | Io non so ben ridir com'i' v'intrai, |
| 467 | tant'era pien di sonno a quel punto |
| 468 | che la verace via abbandonai. |
| 469 | Ma poi ch'i' fui al piè d'un colle giunto, |
| 470 | là dove terminava quella valle |
| 471 | che m'avea di paura il cor compunto, |
| 472 | guardai in alto, e vidi le sue spalle |
| 473 | vestite già de' raggi del pianeta |
| 474 | che mena dritto altrui per ogne calle. |
| 475 | Allor fu la paura un poco queta |
| 476 | che nel lago del cor m'era durata |
| 477 | la notte ch'i' passai con tanta pieta. |
| 478 | E come quei che con lena affannata |
| 479 | uscito fuor del pelago a la riva |
| 480 | si volge a l'acqua perigliosa e guata, |
| 481 | così l'animo mio, ch'ancor fuggiva, |
| 482 | </div> |
| 483 | </div> |
| 484 | </td> |
| 485 | <td> |
| 486 | <div id="pageContainer1" class="pageContainer"> |
| 487 | <div style="display:none;" id="page3" class="page"></div> |
| 488 | <div id="page1" class="page"> |
| 489 | si volse a retro a rimirar lo passo |
| 490 | che non lasciò già mai persona viva. |
| 491 | Poi ch'èi posato un poco il corpo lasso, |
| 492 | ripresi via per la piaggia diserta, |
| 493 | sì che 'l piè fermo sempre era 'l più basso. |
| 494 | Ed ecco, quasi al cominciar de l'erta, |
| 495 | una lonza leggera e presta molto, |
| 496 | che di pel macolato era coverta; |
| 497 | e non mi si partia dinanzi al volto, |
| 498 | anzi 'mpediva tanto il mio cammino, |
| 499 | ch'i' fui per ritornar più volte vòlto. |
| 500 | Temp'era dal principio del mattino, |
| 501 | e 'l sol montava 'n sù con quelle stelle |
| 502 | ch'eran con lui quando l'amor divino |
| 503 | mosse di prima quelle cose belle; |
| 504 | sì ch'a bene sperar m'era cagione |
| 505 | di quella fiera a la gaetta pelle |
| 506 | l'ora del tempo e la dolce stagione; |
| 507 | ma non sì che paura non mi desse |
| 508 | la vista che m'apparve d'un leone. |
| 509 | Questi parea che contra me venisse |
| 510 | con la test'alta e con rabbiosa fame, |
| 511 | sì che parea che l'aere ne tremesse. |
| 512 | </div> |
| 513 | </div> |
| 514 | </td> |
| 515 | </tr> |
| 516 | </tbody> |
| 517 | </table> |
| 518 | </td> |
| 519 | <td> |
| 520 | <div class="middle"> |
| 521 | <div style="position:absolute;left:30px;top:0"><input type="button" class="button" value="previous page" id="flipPageLeft" /></div> |
| 522 | <div style="position:absolute;right:30px;top:0"><input type="button" class="button" id="flipPageRight" value="next page" /></div> |
| 523 | </div> |
| 524 | </td> |
| 525 | </tr> |
| 526 | </tbody> |
| 527 | </table> |
| 528 | |
| 529 | </body> |
| 530 | </html> |