| 1 |
define(["dojo/_base/lang", "dojo/dom", "dojo/_base/window", "dojo/_base/html", "dojo/dom-geometry", |
| 2 |
"dojo/dom-construct", "dojo/dom-attr", "dojo/_base/fx", "dojo/fx", "./_base", "dojo/fx/easing", "dojo/_base/connect"], |
| 3 |
function(lang, dom, winUtil, htmlUtil, domGeom, domConstruct, domAttr, baseFx, coreFx, fxExt, easingUtil, connectUtil){ |
| 4 |
var dojoxFx = lang.getObject("dojox.fx"); |
| 5 |
lang.mixin(dojoxFx,{ |
| 6 |
_split: function( args){ |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
args.rows = args.rows || 3; |
| 21 |
args.columns = args.columns || 3; |
| 22 |
args.duration = args.duration || 1000; |
| 23 |
|
| 24 |
var node = args.node = dom.byId(args.node), |
| 25 |
parentNode = node.parentNode, |
| 26 |
pNode = parentNode, |
| 27 |
body = winUtil.body(), |
| 28 |
_pos = "position" |
| 29 |
; |
| 30 |
|
| 31 |
while(pNode && pNode != body && htmlUtil.style(pNode, _pos) == "static"){ |
| 32 |
pNode = pNode.parentNode; |
| 33 |
} |
| 34 |
|
| 35 |
var pCoords = pNode != body ? domGeom.position(pNode, true) : { x: 0, y: 0 }, |
| 36 |
coords = domGeom.position(node, true), |
| 37 |
nodeHeight = htmlUtil.style(node, "height"), |
| 38 |
nodeWidth = htmlUtil.style(node, "width"), |
| 39 |
hBorder = htmlUtil.style(node, "borderLeftWidth") + htmlUtil.style(node, "borderRightWidth"), |
| 40 |
vBorder = htmlUtil.style(node, "borderTopWidth") + htmlUtil.style(node, "borderBottomWidth"), |
| 41 |
pieceHeight = Math.ceil(nodeHeight / args.rows), |
| 42 |
pieceWidth = Math.ceil(nodeWidth / args.columns), |
| 43 |
container = domConstruct.create(node.tagName, { |
| 44 |
style: { |
| 45 |
position: "absolute", |
| 46 |
padding: 0, |
| 47 |
margin: 0, |
| 48 |
border:"none", |
| 49 |
top: coords.y - pCoords.y + "px", |
| 50 |
left: coords.x - pCoords.x + "px", |
| 51 |
height: nodeHeight + vBorder + "px", |
| 52 |
width: nodeWidth + hBorder + "px", |
| 53 |
background: "none", |
| 54 |
overflow: args.crop ? "hidden" : "visible", |
| 55 |
zIndex: htmlUtil.style(node, "zIndex") |
| 56 |
} |
| 57 |
}, node, "after"), |
| 58 |
animations = [], |
| 59 |
pieceHelper = domConstruct.create(node.tagName, { |
| 60 |
style: { |
| 61 |
position: "absolute", |
| 62 |
border: "none", |
| 63 |
padding: 0, |
| 64 |
margin: 0, |
| 65 |
height: pieceHeight + hBorder + "px", |
| 66 |
width: pieceWidth + vBorder + "px", |
| 67 |
overflow: "hidden" |
| 68 |
} |
| 69 |
}); |
| 70 |
|
| 71 |
|
| 72 |
for(var y = 0, ly = args.rows; y < ly; y++){ |
| 73 |
for(var x = 0, lx = args.columns; x < lx; x++){ |
| 74 |
|
| 75 |
var piece = lang.clone(pieceHelper), |
| 76 |
pieceContents = lang.clone(node), |
| 77 |
pTop = y * pieceHeight, |
| 78 |
pLeft = x * pieceWidth |
| 79 |
; |
| 80 |
|
| 81 |
|
| 82 |
pieceContents.style.filter = ""; |
| 83 |
|
| 84 |
|
| 85 |
domAttr.remove(pieceContents, "id"); |
| 86 |
|
| 87 |
htmlUtil.style(piece, { |
| 88 |
border: "none", |
| 89 |
overflow: "hidden", |
| 90 |
top: pTop + "px", |
| 91 |
left: pLeft + "px" |
| 92 |
}); |
| 93 |
htmlUtil.style(pieceContents, { |
| 94 |
position: "static", |
| 95 |
opacity: "1", |
| 96 |
marginTop: -pTop + "px", |
| 97 |
marginLeft: -pLeft + "px" |
| 98 |
}); |
| 99 |
piece.appendChild(pieceContents); |
| 100 |
container.appendChild(piece); |
| 101 |
|
| 102 |
var pieceAnimation = args.pieceAnimation(piece, x, y, coords); |
| 103 |
if(lang.isArray(pieceAnimation)){ |
| 104 |
|
| 105 |
animations = animations.concat(pieceAnimation); |
| 106 |
}else{ |
| 107 |
|
| 108 |
animations.push(pieceAnimation); |
| 109 |
} |
| 110 |
} |
| 111 |
} |
| 112 |
var anim = coreFx.combine(animations); |
| 113 |
connectUtil.connect(anim, "onEnd", anim, function(){ |
| 114 |
container.parentNode.removeChild(container); |
| 115 |
}); |
| 116 |
if(args.onPlay){ |
| 117 |
connectUtil.connect(anim, "onPlay", anim, args.onPlay); |
| 118 |
} |
| 119 |
if(args.onEnd){ |
| 120 |
connectUtil.connect(anim, "onEnd", anim, args.onEnd); |
| 121 |
} |
| 122 |
return anim; |
| 123 |
}, |
| 124 |
|
| 125 |
explode: function( args){ |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
var node = args.node = dom.byId(args.node); |
| 145 |
args.rows = args.rows || 3; |
| 146 |
args.columns = args.columns || 3; |
| 147 |
args.distance = args.distance || 1; |
| 148 |
args.duration = args.duration || 1000; |
| 149 |
args.random = args.random || 0; |
| 150 |
if(!args.fade){ |
| 151 |
args.fade = true; |
| 152 |
} |
| 153 |
if(typeof args.sync == "undefined"){ |
| 154 |
args.sync = true; |
| 155 |
} |
| 156 |
args.random = Math.abs(args.random); |
| 157 |
|
| 158 |
|
| 159 |
args.pieceAnimation = function(piece, x, y, coords){ |
| 160 |
var pieceHeight = coords.h / args.rows, |
| 161 |
pieceWidth = coords.w / args.columns, |
| 162 |
distance = args.distance * 2, |
| 163 |
duration = args.duration, |
| 164 |
ps = piece.style, |
| 165 |
startTop = parseInt(ps.top), |
| 166 |
startLeft = parseInt(ps.left), |
| 167 |
delay = 0, |
| 168 |
randomX = 0, |
| 169 |
randomY = 0; |
| 170 |
|
| 171 |
if(args.random){ |
| 172 |
var seed = (Math.random() * args.random) + Math.max(1 - args.random, 0); |
| 173 |
distance *= seed; |
| 174 |
duration *= seed; |
| 175 |
|
| 176 |
delay = ((args.unhide && args.sync) || (!args.unhide && !args.sync)) ? (args.duration - duration) : 0; |
| 177 |
|
| 178 |
randomX = Math.random() - 0.5; |
| 179 |
randomY = Math.random() - 0.5; |
| 180 |
} |
| 181 |
|
| 182 |
var distanceY = ((coords.h - pieceHeight) / 2 - pieceHeight * y), |
| 183 |
distanceX = ((coords.w - pieceWidth) / 2 - pieceWidth * x), |
| 184 |
distanceXY = Math.sqrt(Math.pow(distanceX, 2) + Math.pow(distanceY, 2)), |
| 185 |
endTop = parseInt(startTop - distanceY * distance + distanceXY * randomY), |
| 186 |
endLeft = parseInt(startLeft - distanceX * distance + distanceXY * randomX) |
| 187 |
; |
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
var pieceSlide = baseFx.animateProperty({ |
| 192 |
node: piece, |
| 193 |
duration: duration, |
| 194 |
delay: delay, |
| 195 |
easing: (args.easing || (args.unhide ? easingUtil.sinOut : easingUtil.circOut)), |
| 196 |
beforeBegin: (args.unhide ? function(){ |
| 197 |
if(args.fade){ |
| 198 |
htmlUtil.style(piece, { opacity: "0"}); |
| 199 |
} |
| 200 |
ps.top = endTop + "px"; |
| 201 |
ps.left = endLeft + "px"; |
| 202 |
} : undefined), |
| 203 |
properties: { |
| 204 |
top: (args.unhide ? { start: endTop, end: startTop } : { start: startTop, end: endTop }), |
| 205 |
left: (args.unhide ? { start: endLeft, end: startLeft } : { start: startLeft, end: endLeft }) |
| 206 |
} |
| 207 |
}); |
| 208 |
if(args.fade){ |
| 209 |
var pieceFade = baseFx.animateProperty({ |
| 210 |
node: piece, |
| 211 |
duration: duration, |
| 212 |
delay: delay, |
| 213 |
easing: (args.fadeEasing || easingUtil.quadOut), |
| 214 |
properties: { |
| 215 |
opacity: (args.unhide ? { start: "0", end: "1" } : { start: "1", end: "0" }) |
| 216 |
} |
| 217 |
}); |
| 218 |
|
| 219 |
|
| 220 |
return (args.unhide ? [pieceFade, pieceSlide] : [pieceSlide, pieceFade]); |
| 221 |
}else{ |
| 222 |
|
| 223 |
return pieceSlide; |
| 224 |
} |
| 225 |
}; |
| 226 |
|
| 227 |
var anim = dojoxFx._split(args); |
| 228 |
if(args.unhide){ |
| 229 |
connectUtil.connect(anim, "onEnd", null, function(){ |
| 230 |
htmlUtil.style(node, {opacity: "1" }); |
| 231 |
}); |
| 232 |
}else{ |
| 233 |
connectUtil.connect(anim, "onPlay", null, function(){ |
| 234 |
htmlUtil.style(node, { opacity: "0" }); |
| 235 |
}); |
| 236 |
} |
| 237 |
return anim; |
| 238 |
}, |
| 239 |
|
| 240 |
converge: function( args){ |
| 241 |
args.unhide = true; |
| 242 |
return dojoxFx.explode(args); |
| 243 |
}, |
| 244 |
|
| 245 |
disintegrate: function( args){ |
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
var node = args.node = dom.byId(args.node); |
| 262 |
|
| 263 |
args.rows = args.rows || 5; |
| 264 |
args.columns = args.columns || 5; |
| 265 |
args.duration = args.duration || 1500; |
| 266 |
args.interval = args.interval || args.duration / (args.rows + args.columns * 2); |
| 267 |
args.distance = args.distance || 1.5; |
| 268 |
args.random = args.random || 0; |
| 269 |
if(typeof args.fade == "undefined"){ |
| 270 |
args.fade = true; |
| 271 |
} |
| 272 |
|
| 273 |
var random = Math.abs(args.random), |
| 274 |
duration = args.duration - (args.rows + args.columns) * args.interval; |
| 275 |
|
| 276 |
|
| 277 |
args.pieceAnimation = function(piece, x, y, coords){ |
| 278 |
|
| 279 |
var randomDelay = Math.random() * (args.rows + args.columns) * args.interval, |
| 280 |
ps = piece.style, |
| 281 |
|
| 282 |
|
| 283 |
uniformDelay = (args.reverseOrder || args.distance < 0) ? |
| 284 |
((x + y) * args.interval) : |
| 285 |
(((args.rows + args.columns) - (x + y)) * args.interval), |
| 286 |
delay = randomDelay * random + Math.max(1 - random, 0) * uniformDelay, |
| 287 |
|
| 288 |
properties = {} |
| 289 |
; |
| 290 |
if(args.unhide){ |
| 291 |
properties.top = { |
| 292 |
start: (parseInt(ps.top) - coords.h * args.distance), |
| 293 |
end: parseInt(ps.top) |
| 294 |
}; |
| 295 |
if(args.fade){ |
| 296 |
properties.opacity = {start: "0", end: "1"}; |
| 297 |
} |
| 298 |
}else{ |
| 299 |
properties.top = {end: (parseInt(ps.top) + coords.h * args.distance)}; |
| 300 |
if(args.fade){ |
| 301 |
properties.opacity = {end: "0"}; |
| 302 |
} |
| 303 |
} |
| 304 |
var pieceAnimation = baseFx.animateProperty({ |
| 305 |
node: piece, |
| 306 |
duration: duration, |
| 307 |
delay: delay, |
| 308 |
easing: (args.easing || (args.unhide ? easingUtil.sinIn : easingUtil.circIn)), |
| 309 |
properties: properties, |
| 310 |
beforeBegin: (args.unhide ? function(){ |
| 311 |
if(args.fade){ |
| 312 |
htmlUtil.style(piece, { opacity: "0" }); |
| 313 |
} |
| 314 |
ps.top = properties.top.start + "px"; |
| 315 |
} : undefined) |
| 316 |
}); |
| 317 |
|
| 318 |
return pieceAnimation; |
| 319 |
}; |
| 320 |
|
| 321 |
var anim = dojoxFx._split(args); |
| 322 |
if(args.unhide){ |
| 323 |
connectUtil.connect(anim, "onEnd", anim, function(){ |
| 324 |
htmlUtil.style(node, { opacity: "1" }); |
| 325 |
}); |
| 326 |
}else{ |
| 327 |
connectUtil.connect(anim, "onPlay", anim, function(){ |
| 328 |
htmlUtil.style(node, { opacity: "0" }); |
| 329 |
}); |
| 330 |
} |
| 331 |
return anim; |
| 332 |
}, |
| 333 |
|
| 334 |
build: function( args){ |
| 335 |
args.unhide = true; |
| 336 |
return dojoxFx.disintegrate(args); |
| 337 |
}, |
| 338 |
|
| 339 |
shear: function( args){ |
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
var node = args.node = dom.byId(args.node); |
| 357 |
|
| 358 |
args.rows = args.rows || 6; |
| 359 |
args.columns = args.columns || 6; |
| 360 |
args.duration = args.duration || 1000; |
| 361 |
args.interval = args.interval || 0; |
| 362 |
args.distance = args.distance || 1; |
| 363 |
args.random = args.random || 0; |
| 364 |
if(typeof(args.fade) == "undefined"){ |
| 365 |
args.fade = true; |
| 366 |
} |
| 367 |
var random = Math.abs(args.random), |
| 368 |
duration = (args.duration - (args.rows + args.columns) * Math.abs(args.interval)) |
| 369 |
; |
| 370 |
|
| 371 |
|
| 372 |
args.pieceAnimation = function(piece, x, y, coords){ |
| 373 |
|
| 374 |
|
| 375 |
var colIsOdd = !(x % 2), |
| 376 |
rowIsOdd = !(y % 2), |
| 377 |
randomDelay = Math.random() * duration, |
| 378 |
uniformDelay = (args.reverseOrder) ? |
| 379 |
(((args.rows + args.columns) - (x + y)) * args.interval) : |
| 380 |
((x + y) * args.interval), |
| 381 |
delay = randomDelay * random + Math.max(1 - random, 0) * uniformDelay, |
| 382 |
properties = {}, |
| 383 |
ps = piece.style |
| 384 |
; |
| 385 |
|
| 386 |
if(args.fade){ |
| 387 |
properties.opacity = (args.unhide ? { start: "0", end: "1" } : { end: "0" }); |
| 388 |
} |
| 389 |
|
| 390 |
|
| 391 |
if(args.columns == 1){ |
| 392 |
colIsOdd = rowIsOdd; |
| 393 |
}else if(args.rows == 1){ |
| 394 |
rowIsOdd = !colIsOdd; |
| 395 |
} |
| 396 |
|
| 397 |
|
| 398 |
var left = parseInt(ps.left), |
| 399 |
top = parseInt(ps.top), |
| 400 |
distanceX = args.distance*coords.w, |
| 401 |
distanceY = args.distance*coords.h |
| 402 |
; |
| 403 |
if(args.unhide){ |
| 404 |
if(colIsOdd == rowIsOdd){ |
| 405 |
properties.left = colIsOdd ? {start: (left - distanceX), end: left} : {start: (left + distanceX), end: left}; |
| 406 |
}else{ |
| 407 |
properties.top = colIsOdd ? {start: (top + distanceY), end: top} : {start: (top - distanceY), end: top}; |
| 408 |
} |
| 409 |
}else{ |
| 410 |
if(colIsOdd == rowIsOdd){ |
| 411 |
properties.left = colIsOdd ? {end: (left - distanceX)} : {end: (left + distanceX)}; |
| 412 |
}else{ |
| 413 |
properties.top = colIsOdd ? {end: (top + distanceY)} : {end: (top - distanceY)}; |
| 414 |
} |
| 415 |
} |
| 416 |
|
| 417 |
|
| 418 |
var pieceAnimation = baseFx.animateProperty({ |
| 419 |
node: piece, |
| 420 |
duration: duration, |
| 421 |
delay: delay, |
| 422 |
easing: (args.easing || easingUtil.sinInOut), |
| 423 |
properties: properties, |
| 424 |
beforeBegin: (args.unhide ? function(){ |
| 425 |
if(args.fade){ |
| 426 |
ps.opacity = "0"; |
| 427 |
} |
| 428 |
if(colIsOdd == rowIsOdd){ |
| 429 |
ps.left = properties.left.start + "px"; |
| 430 |
}else{ |
| 431 |
ps.top = properties.top.start + "px"; |
| 432 |
} |
| 433 |
} : undefined) |
| 434 |
}); |
| 435 |
|
| 436 |
return pieceAnimation; |
| 437 |
}; |
| 438 |
|
| 439 |
var anim = dojoxFx._split(args); |
| 440 |
if(args.unhide){ |
| 441 |
connectUtil.connect(anim, "onEnd", anim, function(){ |
| 442 |
htmlUtil.style(node, { opacity: "1" }); |
| 443 |
}); |
| 444 |
}else{ |
| 445 |
connectUtil.connect(anim, "onPlay", anim, function(){ |
| 446 |
htmlUtil.style(node, { opacity: "0" }); |
| 447 |
}); |
| 448 |
} |
| 449 |
return anim; |
| 450 |
}, |
| 451 |
|
| 452 |
unShear: function( args){ |
| 453 |
args.unhide = true; |
| 454 |
return dojoxFx.shear(args); |
| 455 |
}, |
| 456 |
|
| 457 |
pinwheel: function( args){ |
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
var node = args.node = dom.byId(args.node); |
| 474 |
|
| 475 |
args.rows = args.rows || 4; |
| 476 |
args.columns = args.columns || 4; |
| 477 |
args.duration = args.duration || 1000; |
| 478 |
args.interval = args.interval || 0; |
| 479 |
args.distance = args.distance || 1; |
| 480 |
args.random = args.random || 0; |
| 481 |
if(typeof args.fade == "undefined"){ |
| 482 |
args.fade = true; |
| 483 |
} |
| 484 |
var duration = (args.duration - (args.rows + args.columns) * Math.abs(args.interval)); |
| 485 |
|
| 486 |
|
| 487 |
args.pieceAnimation = function(piece, x, y, coords){ |
| 488 |
var pieceHeight = coords.h / args.rows, |
| 489 |
pieceWidth = coords.w / args.columns, |
| 490 |
|
| 491 |
|
| 492 |
colIsOdd = !(x % 2), |
| 493 |
rowIsOdd = !(y % 2), |
| 494 |
|
| 495 |
randomDelay = Math.random() * duration, |
| 496 |
uniformDelay = (args.interval < 0) ? |
| 497 |
(((args.rows + args.columns) - (x + y)) * args.interval * -1) : |
| 498 |
((x + y) * args.interval), |
| 499 |
delay = randomDelay * args.random + Math.max(1 - args.random, 0) * uniformDelay, |
| 500 |
properties = {}, |
| 501 |
ps = piece.style |
| 502 |
; |
| 503 |
|
| 504 |
if(args.fade){ |
| 505 |
properties.opacity = (args.unhide ? {start: 0, end: 1} : {end:0}); |
| 506 |
} |
| 507 |
|
| 508 |
|
| 509 |
if(args.columns == 1){ |
| 510 |
colIsOdd = !rowIsOdd; |
| 511 |
}else if(args.rows == 1){ |
| 512 |
rowIsOdd = colIsOdd; |
| 513 |
} |
| 514 |
|
| 515 |
|
| 516 |
var left = parseInt(ps.left), |
| 517 |
top = parseInt(ps.top) |
| 518 |
; |
| 519 |
if(colIsOdd){ |
| 520 |
if(rowIsOdd){ |
| 521 |
properties.top = args.unhide ? |
| 522 |
{ start: top + pieceHeight * args.distance, end: top} : |
| 523 |
{ start: top, end: top + pieceHeight * args.distance} ; |
| 524 |
}else{ |
| 525 |
properties.left = args.unhide ? |
| 526 |
{ start: left + pieceWidth * args.distance, end: left } : |
| 527 |
{ start: left, end: left + pieceWidth * args.distance } ; |
| 528 |
} |
| 529 |
} |
| 530 |
if(colIsOdd != rowIsOdd){ |
| 531 |
properties.width = args.unhide ? |
| 532 |
{ start: pieceWidth * (1 - args.distance), end: pieceWidth } : |
| 533 |
{ start: pieceWidth, end: pieceWidth * (1 - args.distance) } ; |
| 534 |
}else{ |
| 535 |
properties.height = args.unhide ? |
| 536 |
{ start: pieceHeight * (1 - args.distance), end: pieceHeight } : |
| 537 |
{ start: pieceHeight, end: pieceHeight * (1 - args.distance) } ; |
| 538 |
} |
| 539 |
|
| 540 |
|
| 541 |
var pieceAnimation = baseFx.animateProperty({ |
| 542 |
node: piece, |
| 543 |
duration: duration, |
| 544 |
delay: delay, |
| 545 |
easing: (args.easing || easingUtil.sinInOut), |
| 546 |
properties: properties, |
| 547 |
beforeBegin: (args.unhide ? function(){ |
| 548 |
if(args.fade){ |
| 549 |
htmlUtil.style(piece, "opacity", 0); |
| 550 |
} |
| 551 |
if(colIsOdd){ |
| 552 |
if(rowIsOdd){ |
| 553 |
ps.top = (top + pieceHeight * (1 - args.distance)) + "px"; |
| 554 |
}else{ |
| 555 |
ps.left = (left + pieceWidth * (1 - args.distance)) + "px"; |
| 556 |
} |
| 557 |
}else{ |
| 558 |
ps.left = left + "px"; |
| 559 |
ps.top = top + "px"; |
| 560 |
} |
| 561 |
if(colIsOdd != rowIsOdd){ |
| 562 |
ps.width = (pieceWidth * (1 - args.distance)) + "px"; |
| 563 |
}else{ |
| 564 |
ps.height = (pieceHeight * (1 - args.distance)) + "px"; |
| 565 |
} |
| 566 |
} : undefined) |
| 567 |
}); |
| 568 |
|
| 569 |
return pieceAnimation; |
| 570 |
}; |
| 571 |
|
| 572 |
var anim = dojoxFx._split(args); |
| 573 |
if(args.unhide){ |
| 574 |
connectUtil.connect(anim, "onEnd", anim, function(){ |
| 575 |
htmlUtil.style(node, { opacity: "1" }); |
| 576 |
}); |
| 577 |
}else{ |
| 578 |
connectUtil.connect(anim, "play", anim, function(){ |
| 579 |
htmlUtil.style(node, { opacity: "0" }); |
| 580 |
}); |
| 581 |
} |
| 582 |
return anim; |
| 583 |
}, |
| 584 |
|
| 585 |
unPinwheel: function( args){ |
| 586 |
args.unhide = true; |
| 587 |
return dojoxFx.pinwheel(args); |
| 588 |
}, |
| 589 |
|
| 590 |
blockFadeOut: function( args){ |
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
var node = args.node = dom.byId(args.node); |
| 606 |
|
| 607 |
args.rows = args.rows || 5; |
| 608 |
args.columns = args.columns || 5; |
| 609 |
args.duration = args.duration || 1000; |
| 610 |
args.interval = args.interval || args.duration / (args.rows + args.columns * 2); |
| 611 |
args.random = args.random || 0; |
| 612 |
var random = Math.abs(args.random), |
| 613 |
duration = args.duration - (args.rows + args.columns) * args.interval |
| 614 |
; |
| 615 |
|
| 616 |
|
| 617 |
args.pieceAnimation = function(piece, x, y, coords){ |
| 618 |
var randomDelay = Math.random() * args.duration, |
| 619 |
uniformDelay = (args.reverseOrder) ? |
| 620 |
(((args.rows + args.columns) - (x + y)) * Math.abs(args.interval)) : |
| 621 |
((x + y) * args.interval), |
| 622 |
delay = randomDelay * random + Math.max(1 - random, 0) * uniformDelay, |
| 623 |
|
| 624 |
pieceAnimation = baseFx.animateProperty({ |
| 625 |
node: piece, |
| 626 |
duration: duration, |
| 627 |
delay: delay, |
| 628 |
easing: (args.easing || easingUtil.sinInOut), |
| 629 |
properties: { |
| 630 |
opacity: (args.unhide ? {start: "0", end: "1"} : {start: "1", end: "0"}) |
| 631 |
}, |
| 632 |
beforeBegin: (args.unhide ? function(){ htmlUtil.style(piece, { opacity: "0" });} : function(){ piece.style.filter = ""; }) |
| 633 |
}); |
| 634 |
|
| 635 |
return pieceAnimation; |
| 636 |
}; |
| 637 |
var anim = dojoxFx._split(args); |
| 638 |
if(args.unhide){ |
| 639 |
connectUtil.connect(anim, "onEnd", anim, function(){ |
| 640 |
htmlUtil.style(node, { opacity: "1" }); |
| 641 |
}); |
| 642 |
}else{ |
| 643 |
connectUtil.connect(anim, "onPlay", anim, function(){ |
| 644 |
htmlUtil.style(node, { opacity: "0" }); |
| 645 |
}); |
| 646 |
} |
| 647 |
return anim; |
| 648 |
}, |
| 649 |
|
| 650 |
blockFadeIn: function( args){ |
| 651 |
args.unhide = true; |
| 652 |
return dojoxFx.blockFadeOut(args); |
| 653 |
} |
| 654 |
}); |
| 655 |
return fxExt; |
| 656 |
}); |