1 /****************************************************************************
  2  Copyright (c) 2008-2010 Ricardo Quesada
  3  Copyright (c) 2011-2012 cocos2d-x.org
  4  Copyright (c) 2013-2014 Chukong Technologies Inc.
  5 
  6  http://www.cocos2d-x.org
  7 
  8  Permission is hereby granted, free of charge, to any person obtaining a copy
  9  of this software and associated documentation files (the "Software"), to deal
 10  in the Software without restriction, including without limitation the rights
 11  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 12  copies of the Software, and to permit persons to whom the Software is
 13  furnished to do so, subject to the following conditions:
 14 
 15  The above copyright notice and this permission notice shall be included in
 16  all copies or substantial portions of the Software.
 17 
 18  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 19  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 20  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 21  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 22  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 23  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 24  THE SOFTWARE.
 25  ****************************************************************************/
 26 /**
 27  * A tag constant for identifying fade scenes
 28  * @constant
 29  * @type Number
 30  */
 31 cc.SCENE_FADE = 4208917214;
 32 
 33 /**
 34  * horizontal orientation Type where the Left is nearer
 35  * @constant
 36  * @type Number
 37  */
 38 cc.TRANSITION_ORIENTATION_LEFT_OVER = 0;
 39 /**
 40  * horizontal orientation type where the Right is nearer
 41  * @constant
 42  * @type Number
 43  */
 44 cc.TRANSITION_ORIENTATION_RIGHT_OVER = 1;
 45 /**
 46  * vertical orientation type where the Up is nearer
 47  * @constant
 48  * @type Number
 49  */
 50 cc.TRANSITION_ORIENTATION_UP_OVER = 0;
 51 /**
 52  * vertical orientation type where the Bottom is nearer
 53  * @constant
 54  * @type Number
 55  */
 56 cc.TRANSITION_ORIENTATION_DOWN_OVER = 1;
 57 
 58 /**
 59  * @class
 60  * @extends cc.Scene
 61  * @param {Number} t time in seconds
 62  * @param {cc.Scene} scene the scene to transit with
 63  * @example
 64  * var trans = new TransitionScene(time,scene);
 65  */
 66 cc.TransitionScene = cc.Scene.extend(/** @lends cc.TransitionScene# */{
 67     _inScene:null,
 68     _outScene:null,
 69     _duration:null,
 70     _isInSceneOnTop:false,
 71     _isSendCleanupToScene:false,
 72     _className:"TransitionScene",
 73 
 74     /**
 75      * creates a base transition with duration and incoming scene
 76      * Constructor of cc.TransitionScene
 77      * @param {Number} t time in seconds
 78      * @param {cc.Scene} scene the scene to transit with
 79      */
 80     ctor:function (t, scene) {
 81         cc.Scene.prototype.ctor.call(this);
 82         if(t !== undefined && scene !== undefined)
 83             this.initWithDuration(t, scene);
 84     },
 85 
 86     //private
 87     _setNewScene:function (dt) {
 88         this.unschedule(this._setNewScene);
 89         // Before replacing, save the "send cleanup to scene"
 90         var director = cc.director;
 91         this._isSendCleanupToScene = director.isSendCleanupToScene();
 92         director.runScene(this._inScene);
 93 
 94         // enable events while transitions
 95         cc.eventManager.setEnabled(true);
 96 
 97         // issue #267
 98         this._outScene.visible = true;
 99     },
100 
101     //protected
102     _sceneOrder:function () {
103         this._isInSceneOnTop = true;
104     },
105 
106     /**
107      * stuff gets drawn here
108      */
109     visit:function () {
110         if (this._isInSceneOnTop) {
111             this._outScene.visit();
112             this._inScene.visit();
113         } else {
114             this._inScene.visit();
115             this._outScene.visit();
116         }
117         cc.Node.prototype.visit.call(this);
118     },
119 
120     /**
121      *  <p>
122      *     Event callback that is invoked every time when cc.TransitionScene enters the 'stage'.                                   <br/>
123      *     If the TransitionScene enters the 'stage' with a transition, this event is called when the transition starts.        <br/>
124      *     During onEnter you can't access a "sister/brother" node.                                                    <br/>
125      *     If you override onEnter, you must call its parent's onEnter function with this._super().
126      * </p>
127      */
128     onEnter:function () {
129         cc.Node.prototype.onEnter.call(this);
130 
131         // disable events while transitions
132         cc.eventManager.setEnabled(false);
133 
134         // outScene should not receive the onEnter callback
135         // only the onExitTransitionDidStart
136         this._outScene.onExitTransitionDidStart();
137 
138         this._inScene.onEnter();
139     },
140 
141     /**
142      *  <p>
143      * callback that is called every time the cc.TransitionScene leaves the 'stage'.                                         <br/>
144      * If the cc.TransitionScene leaves the 'stage' with a transition, this callback is called when the transition finishes. <br/>
145      * During onExit you can't access a sibling node.                                                             <br/>
146      * If you override onExit, you shall call its parent's onExit with this._super().
147      * </p>
148      */
149     onExit:function () {
150         cc.Node.prototype.onExit.call(this);
151 
152         // enable events while transitions
153         cc.eventManager.setEnabled(true);
154 
155         this._outScene.onExit();
156 
157         // _inScene should not receive the onEnter callback
158         // only the onEnterTransitionDidFinish
159         this._inScene.onEnterTransitionDidFinish();
160     },
161 
162     /**
163      * custom cleanup
164      */
165     cleanup:function () {
166         cc.Node.prototype.cleanup.call(this);
167 
168         if (this._isSendCleanupToScene)
169             this._outScene.cleanup();
170     },
171 
172     /**
173      * initializes a transition with duration and incoming scene
174      * @param {Number} t time in seconds
175      * @param {cc.Scene} scene a scene to transit to
176      * @return {Boolean} return false if error
177      */
178     initWithDuration:function (t, scene) {
179         if(!scene)
180             throw new Error("cc.TransitionScene.initWithDuration(): Argument scene must be non-nil");
181 
182         if (this.init()) {
183             this._duration = t;
184             this.attr({
185 	            x: 0,
186 	            y: 0,
187 	            anchorX: 0,
188 	            anchorY: 0
189             });
190             // retain
191             this._inScene = scene;
192             this._outScene = cc.director.getRunningScene();
193             if (!this._outScene) {
194                 this._outScene = new cc.Scene();
195                 this._outScene.init();
196             }
197 
198             if(this._inScene === this._outScene)
199                 throw new Error("cc.TransitionScene.initWithDuration(): Incoming scene must be different from the outgoing scene");
200 
201             this._sceneOrder();
202             return true;
203         } else {
204             return false;
205         }
206     },
207 
208     /**
209      * called after the transition finishes
210      */
211     finish:function () {
212         // clean up
213         this._inScene.attr({
214 			visible: true,
215 	        x: 0,
216 	        y: 0,
217 	        scale: 1.0,
218 	        rotation: 0.0
219         });
220 
221         this._outScene.attr({
222 	        visible: false,
223 	        x: 0,
224 	        y: 0,
225 	        scale: 1.0,
226 	        rotation: 0.0
227         });
228 
229         //[self schedule:@selector(setNewScene:) interval:0];
230         this.schedule(this._setNewScene, 0);
231     },
232 
233     /**
234      * set hide the out scene and show in scene
235      */
236     hideOutShowIn:function () {
237         this._inScene.visible = true;
238         this._outScene.visible = false;
239     }
240 });
241 /**
242  * creates a base transition with duration and incoming scene
243  * @deprecated since v3.0, please use new cc.TransitionScene(t,scene) instead
244  * @param {Number} t time in seconds
245  * @param {cc.Scene} scene the scene to transit with
246  * @return {cc.TransitionScene|Null}
247  */
248 cc.TransitionScene.create = function (t, scene) {
249     return new cc.TransitionScene(t, scene);
250 };
251 
252 /**
253  * A cc.Transition that supports orientation like.<br/>
254  * Possible orientation: LeftOver, RightOver, UpOver, DownOver<br/>
255  * useful for when you want to make a transition happen between 2 orientations
256  * @class
257  * @extends cc.TransitionScene
258  * @param {Number} t time in seconds
259  * @param {cc.Scene} scene
260  * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} orientation
261  * @example
262  * var trans = new cc.TransitionSceneOriented(time,scene,orientation);
263  */
264 cc.TransitionSceneOriented = cc.TransitionScene.extend(/** @lends cc.TransitionSceneOriented# */{
265     _orientation:0,
266 
267     /**
268      * Constructor of TransitionSceneOriented
269      * @param {Number} t time in seconds
270      * @param {cc.Scene} scene
271      * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} orientation
272      */
273     ctor:function (t, scene, orientation) {
274         cc.TransitionScene.prototype.ctor.call(this);
275         orientation != undefined && this.initWithDuration(t, scene, orientation);
276     },
277     /**
278      * initialize the transition
279      * @param {Number} t time in seconds
280      * @param {cc.Scene} scene
281      * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} orientation
282      * @return {Boolean}
283      */
284     initWithDuration:function (t, scene, orientation) {
285         if (cc.TransitionScene.prototype.initWithDuration.call(this, t, scene)) {
286             this._orientation = orientation;
287         }
288         return true;
289     }
290 });
291 
292 /**
293  * creates a base transition with duration and incoming scene
294  * @deprecated since v3.0 ,please use new cc.TransitionSceneOriented(t, scene, orientation) instead.
295  * @param {Number} t time in seconds
296  * @param {cc.Scene} scene
297  * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} orientation
298  * @return {cc.TransitionSceneOriented}
299  */
300 cc.TransitionSceneOriented.create = function (t, scene, orientation) {
301     return new cc.TransitionSceneOriented(t, scene, orientation);
302 };
303 
304 /**
305  *  Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming
306  * @class
307  * @extends cc.TransitionScene
308  * @param {Number} t time in seconds
309  * @param {cc.Scene} scene
310  * @example
311  * var trans = new cc.TransitionRotoZoom(t, scene);
312  */
313 cc.TransitionRotoZoom = cc.TransitionScene.extend(/** @lends cc.TransitionRotoZoom# */{
314 
315     /**
316      * Constructor of TransitionRotoZoom
317      * @function
318      * @param {Number} t time in seconds
319      * @param {cc.Scene} scene
320      */
321     ctor:function (t, scene) {
322         cc.TransitionScene.prototype.ctor.call(this);
323         scene && this.initWithDuration(t, scene);
324     },
325     /**
326      * Custom On Enter callback
327      * @override
328      */
329     onEnter:function () {
330         cc.TransitionScene.prototype.onEnter.call(this);
331 
332 	    this._inScene.attr({
333 		    scale: 0.001,
334 		    anchorX: 0.5,
335 		    anchorY: 0.5
336 	    });
337 	    this._outScene.attr({
338 		    scale: 1.0,
339 		    anchorX: 0.5,
340 		    anchorY: 0.5
341 	    });
342 
343         var rotoZoom = cc.sequence(
344             cc.spawn(cc.scaleBy(this._duration / 2, 0.001),
345                 cc.rotateBy(this._duration / 2, 360 * 2)),
346             cc.delayTime(this._duration / 2));
347 
348         this._outScene.runAction(rotoZoom);
349         this._inScene.runAction(
350             cc.sequence(rotoZoom.reverse(),
351                 cc.callFunc(this.finish, this)));
352     }
353 });
354 
355 /**
356  * Creates a Transition rotation and zoom
357  * @deprecated since v3.0,please use new cc.TransitionRotoZoom(t, scene) instead
358  * @param {Number} t time in seconds
359  * @param {cc.Scene} scene the scene to work with
360  * @return {cc.TransitionRotoZoom}
361  */
362 cc.TransitionRotoZoom.create = function (t, scene) {
363     return new cc.TransitionRotoZoom(t, scene);
364 };
365 
366 /**
367  * Zoom out and jump the outgoing scene, and then jump and zoom in the incoming
368  * @class
369  * @extends cc.TransitionScene
370  * @param {Number} t time in seconds
371  * @param {cc.Scene} scene
372  * @example
373  * var trans = new cc.TransitionJumpZoom(t, scene);
374  */
375 cc.TransitionJumpZoom = cc.TransitionScene.extend(/** @lends cc.TransitionJumpZoom# */{
376     /**
377      * Constructor of TransitionJumpZoom
378      * @param {Number} t time in seconds
379      * @param {cc.Scene} scene
380      */
381     ctor:function (t, scene) {
382         cc.TransitionScene.prototype.ctor.call(this);
383         scene && this.initWithDuration(t, scene);
384     },
385     /**
386      * Custom on enter
387      */
388     onEnter:function () {
389         cc.TransitionScene.prototype.onEnter.call(this);
390         var winSize = cc.director.getWinSize();
391 
392 	    this._inScene.attr({
393 		    scale: 0.5,
394 		    x: winSize.width,
395 		    y: 0,
396 		    anchorX: 0.5,
397 		    anchorY: 0.5
398 	    });
399         this._outScene.anchorX = 0.5;
400 	    this._outScene.anchorY = 0.5;
401 
402         var jump = cc.jumpBy(this._duration / 4, cc.p(-winSize.width, 0), winSize.width / 4, 2);
403         var scaleIn = cc.scaleTo(this._duration / 4, 1.0);
404         var scaleOut = cc.scaleTo(this._duration / 4, 0.5);
405 
406         var jumpZoomOut = cc.sequence(scaleOut, jump);
407         var jumpZoomIn = cc.sequence(jump, scaleIn);
408 
409         var delay = cc.delayTime(this._duration / 2);
410         this._outScene.runAction(jumpZoomOut);
411         this._inScene.runAction(cc.sequence(delay, jumpZoomIn, cc.callFunc(this.finish, this)));
412     }
413 });
414 
415 /**
416  * creates a scene transition that zooms then jump across the screen, the same for the incoming scene
417  * @deprecated since v3.0,please use new cc.TransitionJumpZoom(t, scene);
418  * @param {Number} t time in seconds
419  * @param {cc.Scene} scene
420  * @return {cc.TransitionJumpZoom}
421  */
422 cc.TransitionJumpZoom.create = function (t, scene) {
423     return new cc.TransitionJumpZoom(t, scene);
424 };
425 
426 /**
427  * Move in from to the left the incoming scene.
428  * @class
429  * @extends cc.TransitionScene
430  * @param {Number} t time in seconds
431  * @param {cc.Scene} scene
432  * @example
433  * var trans = new cc.TransitionMoveInL(time,scene);
434  */
435 cc.TransitionMoveInL = cc.TransitionScene.extend(/** @lends cc.TransitionMoveInL# */{
436     /**
437      * Constructor of TransitionMoveInL
438      * @param {Number} t time in seconds
439      * @param {cc.Scene} scene
440      */
441     ctor:function (t, scene) {
442         cc.TransitionScene.prototype.ctor.call(this);
443         scene && this.initWithDuration(t, scene);
444     },
445     /**
446      * Custom on enter
447      */
448     onEnter:function () {
449         cc.TransitionScene.prototype.onEnter.call(this);
450         this.initScenes();
451 
452         var action = this.action();
453         this._inScene.runAction(
454             cc.sequence(this.easeActionWithAction(action), cc.callFunc(this.finish, this))
455         );
456     },
457 
458     /**
459      * initializes the scenes
460      */
461     initScenes:function () {
462         this._inScene.setPosition(-cc.director.getWinSize().width, 0);
463     },
464 
465     /**
466      * returns the action that will be performed
467      */
468     action:function () {
469         return cc.moveTo(this._duration, cc.p(0, 0));
470     },
471 
472     /**
473      * creates an ease action from action
474      * @param {cc.ActionInterval} action
475      * @return {cc.EaseOut}
476      */
477     easeActionWithAction:function (action) {
478         return new cc.EaseOut(action, 2.0);
479     }
480 });
481 
482 /**
483  * creates an action that  Move in from to the left the incoming scene.
484  * @deprecated since v3.0,please use new cc.TransitionMoveInL(t, scene) instead
485  * @param {Number} t time in seconds
486  * @param {cc.Scene} scene
487  * @return {cc.TransitionMoveInL}
488  */
489 cc.TransitionMoveInL.create = function (t, scene) {
490     return new cc.TransitionMoveInL(t, scene);
491 };
492 
493 /**
494  * Move in from to the right the incoming scene.
495  * @class
496  * @extends cc.TransitionMoveInL
497  * @param {Number} t time in seconds
498  * @param {cc.Scene} scene
499  * @example
500  * var trans = new cc.TransitionMoveInR(time,scene);
501  */
502 cc.TransitionMoveInR = cc.TransitionMoveInL.extend(/** @lends cc.TransitionMoveInR# */{
503     /**
504      * Constructor of TransitionMoveInR
505      * @param {Number} t time in seconds
506      * @param {cc.Scene} scene
507      */
508     ctor:function (t, scene) {
509         cc.TransitionMoveInL.prototype.ctor.call(this);
510         scene && this.initWithDuration(t, scene);
511     },
512     /**
513      * Init function
514      */
515     initScenes:function () {
516         this._inScene.setPosition(cc.director.getWinSize().width, 0);
517     }
518 });
519 
520 /**
521  * create a scene transition that Move in from to the right the incoming scene.
522  * @deprecated since v3.0,please use new cc.TransitionMoveInR(t, scene) instead
523  * @param {Number} t time in seconds
524  * @param {cc.Scene} scene
525  * @return {cc.TransitionMoveInR}
526  */
527 cc.TransitionMoveInR.create = function (t, scene) {
528     return new cc.TransitionMoveInR(t, scene);
529 };
530 
531 /**
532  * Move in from to the top the incoming scene.
533  * @class
534  * @extends cc.TransitionMoveInL
535  * @param {Number} t time in seconds
536  * @param {cc.Scene} scene
537  * @example
538  * var trans = new cc.TransitionMoveInT(time,scene);
539  */
540 cc.TransitionMoveInT = cc.TransitionMoveInL.extend(/** @lends cc.TransitionMoveInT# */{
541     /**
542      * Constructor of TransitionMoveInT
543      * @param {Number} t time in seconds
544      * @param {cc.Scene} scene
545      */
546     ctor:function (t, scene) {
547         cc.TransitionMoveInL.prototype.ctor.call(this);
548         scene && this.initWithDuration(t, scene);
549     },
550     /**
551      * init function
552      */
553     initScenes:function () {
554         this._inScene.setPosition(0, cc.director.getWinSize().height);
555     }
556 });
557 
558 /**
559  * Move in from to the top the incoming scene.
560  * @deprecated since v3.0,please use new cc.TransitionMoveInT(t, scene) instead
561  * @param {Number} t time in seconds
562  * @param {cc.Scene} scene
563  * @return {cc.TransitionMoveInT}
564  */
565 cc.TransitionMoveInT.create = function (t, scene) {
566     return new cc.TransitionMoveInT(t, scene);
567 };
568 
569 /**
570  *  Move in from to the bottom the incoming scene.
571  * @class
572  * @extends cc.TransitionMoveInL
573  * @param {Number} t time in seconds
574  * @param {cc.Scene} scene
575  * @example
576  * var trans = new cc.TransitionMoveInB(time,scene);
577  */
578 cc.TransitionMoveInB = cc.TransitionMoveInL.extend(/** @lends cc.TransitionMoveInB# */{
579     /**
580      * Constructor of TransitionMoveInB
581      * @param {Number} t time in seconds
582      * @param {cc.Scene} scene
583      */
584     ctor:function (t, scene) {
585         cc.TransitionMoveInL.prototype.ctor.call(this);
586         scene && this.initWithDuration(t, scene);
587     },
588 
589     /**
590      * init function
591      */
592     initScenes:function () {
593         this._inScene.setPosition(0, -cc.director.getWinSize().height);
594     }
595 });
596 
597 /**
598  * create a scene transition that Move in from to the bottom the incoming scene.
599  * @deprecated since v3.0,please use new cc.TransitionMoveInB(t, scene) instead
600  * @param {Number} t time in seconds
601  * @param {cc.Scene} scene
602  * @return {cc.TransitionMoveInB}
603  */
604 cc.TransitionMoveInB.create = function (t, scene) {
605     return new cc.TransitionMoveInB(t, scene);
606 };
607 
608 /**
609  * The adjust factor is needed to prevent issue #442<br/>
610  * One solution is to use DONT_RENDER_IN_SUBPIXELS images, but NO<br/>
611  * The other issue is that in some transitions (and I don't know why)<br/>
612  * the order should be reversed (In in top of Out or vice-versa).
613  * @constant
614  * @type Number
615  */
616 cc.ADJUST_FACTOR = 0.5;
617 
618 /**
619  * a transition that a new scene is slided from left
620  * @class
621  * @extends cc.TransitionScene
622  * @param {Number} t time in seconds
623  * @param {cc.Scene} scene
624  * @example
625  * var trans = cc.TransitionSlideInL(time,scene);
626  */
627 cc.TransitionSlideInL = cc.TransitionScene.extend(/** @lends cc.TransitionSlideInL# */{
628     /**
629      * Constructor of TransitionSlideInL
630      * @param {Number} t time in seconds
631      * @param {cc.Scene} scene
632      */
633     ctor:function (t, scene) {
634         cc.TransitionScene.prototype.ctor.call(this);
635         scene && this.initWithDuration(t, scene);
636     },
637     _sceneOrder:function () {
638         this._isInSceneOnTop = false;
639     },
640 
641     /**
642      * custom on enter
643      */
644     onEnter:function () {
645         cc.TransitionScene.prototype.onEnter.call(this);
646         this.initScenes();
647 
648         var inA = this.action();
649         var outA = this.action();
650 
651         var inAction = cc.sequence(this.easeActionWithAction(inA), cc.callFunc(this.finish, this));
652         var outAction = this.easeActionWithAction(outA);
653         this._inScene.runAction(inAction);
654         this._outScene.runAction(outAction);
655     },
656 
657     /**
658      * initializes the scenes
659      */
660     initScenes:function () {
661         this._inScene.setPosition(-cc.director.getWinSize().width + cc.ADJUST_FACTOR, 0);
662     },
663     /**
664      * returns the action that will be performed by the incoming and outgoing scene
665      * @return {cc.MoveBy}
666      */
667     action:function () {
668         return cc.moveBy(this._duration, cc.p(cc.director.getWinSize().width - cc.ADJUST_FACTOR, 0));
669     },
670 
671     /**
672      * @param {cc.ActionInterval} action
673      * @return {*}
674      */
675     easeActionWithAction:function (action) {
676         return new cc.EaseInOut(action, 2.0);
677     }
678 });
679 
680 /**
681  * create a transition that a new scene is slided from left
682  * @deprecated since v3.0,please use new cc.TransitionSlideInL(t, scene) instead
683  * @param {Number} t time in seconds
684  * @param {cc.Scene} scene
685  * @return {cc.TransitionSlideInL}
686  */
687 cc.TransitionSlideInL.create = function (t, scene) {
688     return new cc.TransitionSlideInL(t, scene);
689 };
690 
691 /**
692  *  Slide in the incoming scene from the right border.
693  * @class
694  * @extends cc.TransitionSlideInL
695  * @param {Number} t time in seconds
696  * @param {cc.Scene} scene
697  * @example
698  * var trans = new cc.TransitionSlideInR(time,scene);
699  */
700 cc.TransitionSlideInR = cc.TransitionSlideInL.extend(/** @lends cc.TransitionSlideInR# */{
701     /**
702      * Constructor of TransitionSlideInR
703      * @param {Number} t time in seconds
704      * @param {cc.Scene} scene
705      */
706     ctor:function (t, scene) {
707         cc.TransitionSlideInL.prototype.ctor.call(this);
708         scene && this.initWithDuration(t, scene);
709     },
710     _sceneOrder:function () {
711         this._isInSceneOnTop = true;
712     },
713     /**
714      * initializes the scenes
715      */
716     initScenes:function () {
717         this._inScene.setPosition(cc.director.getWinSize().width - cc.ADJUST_FACTOR, 0);
718     },
719     /**
720      *  returns the action that will be performed by the incoming and outgoing scene
721      * @return {cc.MoveBy}
722      */
723     action:function () {
724         return cc.moveBy(this._duration, cc.p(-(cc.director.getWinSize().width - cc.ADJUST_FACTOR), 0));
725     }
726 });
727 
728 /**
729  * create Slide in the incoming scene from the right border.
730  * @deprecated since v3.0,please use new cc.TransitionSlideInR(t, scene) instead
731  * @param {Number} t time in seconds
732  * @param {cc.Scene} scene
733  * @return {cc.TransitionSlideInR}
734  */
735 cc.TransitionSlideInR.create = function (t, scene) {
736     return new cc.TransitionSlideInR(t, scene);
737 };
738 
739 /**
740  * Slide in the incoming scene from the bottom border.
741  * @class
742  * @extends cc.TransitionSlideInL
743  * @param {Number} t time in seconds
744  * @param {cc.Scene} scene
745  * @example
746  * var trans = new cc.TransitionSlideInB(time,scene);
747  */
748 cc.TransitionSlideInB = cc.TransitionSlideInL.extend(/** @lends cc.TransitionSlideInB# */{
749     /**
750      * Constructor of TransitionSlideInB
751      * @param {Number} t time in seconds
752      * @param {cc.Scene} scene
753      */
754     ctor:function (t, scene) {
755         cc.TransitionSlideInL.prototype.ctor.call(this);
756         scene && this.initWithDuration(t, scene);
757     },
758     _sceneOrder:function () {
759         this._isInSceneOnTop = false;
760     },
761 
762     /**
763      * initializes the scenes
764      */
765     initScenes:function () {
766         this._inScene.setPosition(0, -(cc.director.getWinSize().height - cc.ADJUST_FACTOR));
767     },
768 
769     /**
770      * returns the action that will be performed by the incoming and outgoing scene
771      * @return {cc.MoveBy}
772      */
773     action:function () {
774         return cc.moveBy(this._duration, cc.p(0, cc.director.getWinSize().height - cc.ADJUST_FACTOR));
775     }
776 });
777 
778 /**
779  * create a Slide in the incoming scene from the bottom border.
780  * @deprecated since v3.0,please use new cc.TransitionSlideInB(t, scene) instead.
781  * @param {Number} t time in seconds
782  * @param {cc.Scene} scene
783  * @return {cc.TransitionSlideInB}
784  */
785 cc.TransitionSlideInB.create = function (t, scene) {
786     return new cc.TransitionSlideInB(t, scene);
787 };
788 
789 /**
790  *  Slide in the incoming scene from the top border.
791  *  @class
792  *  @extends cc.TransitionSlideInL
793  *  @param {Number} t time in seconds
794  *  @param {cc.Scene} scene
795  *  @example
796  *  var trans = new cc.TransitionSlideInT(time,scene);
797  */
798 cc.TransitionSlideInT = cc.TransitionSlideInL.extend(/** @lends cc.TransitionSlideInT# */{
799     /**
800      * Constructor of TransitionSlideInT
801      * @param {Number} t time in seconds
802      * @param {cc.Scene} scene
803      */
804     ctor:function (t, scene) {
805         cc.TransitionSlideInL.prototype.ctor.call(this);
806         scene && this.initWithDuration(t, scene);
807     },
808     _sceneOrder:function () {
809         this._isInSceneOnTop = true;
810     },
811 
812     /**
813      * initializes the scenes
814      */
815     initScenes:function () {
816         this._inScene.setPosition(0, cc.director.getWinSize().height - cc.ADJUST_FACTOR);
817     },
818 
819     /**
820      * returns the action that will be performed by the incoming and outgoing scene
821      * @return {cc.MoveBy}
822      */
823     action:function () {
824         return cc.moveBy(this._duration, cc.p(0, -(cc.director.getWinSize().height - cc.ADJUST_FACTOR)));
825     }
826 });
827 
828 /**
829  * create a Slide in the incoming scene from the top border.
830  * @deprecated since v3.0,please use new cc.TransitionSlideInT(t, scene) instead.
831  * @param {Number} t time in seconds
832  * @param {cc.Scene} scene
833  * @return {cc.TransitionSlideInT}
834  */
835 cc.TransitionSlideInT.create = function (t, scene) {
836     return new cc.TransitionSlideInT(t, scene);
837 };
838 
839 /**
840  * Shrink the outgoing scene while grow the incoming scene
841  * @class
842  * @extends cc.TransitionScene
843  * @param {Number} t time in seconds
844  * @param {cc.Scene} scene
845  * @example
846  * var trans = new cc.TransitionShrinkGrow(time,scene);
847  */
848 cc.TransitionShrinkGrow = cc.TransitionScene.extend(/** @lends cc.TransitionShrinkGrow# */{
849     /**
850      * Constructor of TransitionShrinkGrow
851      * @param {Number} t time in seconds
852      * @param {cc.Scene} scene
853      */
854     ctor:function (t, scene) {
855         cc.TransitionScene.prototype.ctor.call(this);
856         scene && this.initWithDuration(t, scene);
857     },
858     /**
859      * Custom on enter
860      */
861     onEnter:function () {
862         cc.TransitionScene.prototype.onEnter.call(this);
863 
864 	    this._inScene.attr({
865 		    scale: 0.001,
866 		    anchorX: 2 / 3.0,
867 		    anchorY: 0.5
868 	    });
869 	    this._outScene.attr({
870 		    scale: 1.0,
871 		    anchorX: 1 / 3.0,
872 		    anchorY: 0.5
873 	    });
874 
875         var scaleOut = cc.scaleTo(this._duration, 0.01);
876         var scaleIn = cc.scaleTo(this._duration, 1.0);
877 
878         this._inScene.runAction(cc.sequence(this.easeActionWithAction(scaleIn), cc.callFunc(this.finish, this)));
879         this._outScene.runAction(this.easeActionWithAction(scaleOut));
880     },
881 
882     /**
883      * @param action
884      * @return {cc.EaseOut}
885      */
886     easeActionWithAction:function (action) {
887         return new cc.EaseOut(action, 2.0);
888     }
889 });
890 
891 /**
892  * Shrink the outgoing scene while grow the incoming scene
893  * @deprecated since v3.0,please use new cc.TransitionShrinkGrow(t, scene) instead.
894  * @param {Number} t time in seconds
895  * @param {cc.Scene} scene
896  * @return {cc.TransitionShrinkGrow}
897  */
898 cc.TransitionShrinkGrow.create = function (t, scene) {
899     return new cc.TransitionShrinkGrow(t, scene);
900 };
901 
902 /**
903  * Fade out the outgoing scene and then fade in the incoming scene.
904  * @class
905  * @extends cc.TransitionScene
906  * @param {Number} t time in seconds
907  * @param {cc.Scene} scene
908  * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
909  * @example
910  * var trans = new cc.TransitionFade(time,scene,color)
911  */
912 cc.TransitionFade = cc.TransitionScene.extend(/** @lends cc.TransitionFade# */{
913     _color:null,
914 
915     /**
916      * Constructor of TransitionFade
917      * @param {Number} t time in seconds
918      * @param {cc.Scene} scene
919      * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
920      */
921     ctor:function (t, scene, color) {
922         cc.TransitionScene.prototype.ctor.call(this);
923         this._color = cc.color();
924         scene && this.initWithDuration(t, scene, color);
925     },
926 
927     /**
928      * custom on enter
929      */
930     onEnter:function () {
931         cc.TransitionScene.prototype.onEnter.call(this);
932 
933         var l = new cc.LayerColor(this._color);
934         this._inScene.visible = false;
935 
936         this.addChild(l, 2, cc.SCENE_FADE);
937         var f = this.getChildByTag(cc.SCENE_FADE);
938 
939         var a = cc.sequence(
940             cc.fadeIn(this._duration / 2),
941             cc.callFunc(this.hideOutShowIn, this),
942             cc.fadeOut(this._duration / 2),
943             cc.callFunc(this.finish, this)
944         );
945         f.runAction(a);
946     },
947 
948     /**
949      * custom on exit
950      */
951     onExit:function () {
952         cc.TransitionScene.prototype.onExit.call(this);
953         this.removeChildByTag(cc.SCENE_FADE, false);
954     },
955 
956     /**
957      * initializes the transition with a duration and with an RGB color
958      * @param {Number} t time in seconds
959      * @param {cc.Scene} scene
960      * @param {cc.Color} color
961      * @return {Boolean}
962      */
963     initWithDuration:function (t, scene, color) {
964         color = color || cc.color.BLACK;
965         if (cc.TransitionScene.prototype.initWithDuration.call(this, t, scene)) {
966             this._color.r = color.r;
967             this._color.g = color.g;
968             this._color.b = color.b;
969             this._color.a = 0;
970         }
971         return true;
972     }
973 });
974 
975 
976 /**
977  * Fade out the outgoing scene and then fade in the incoming scene.
978  * @deprecated since v3.0,please use new cc.TransitionFade(time,scene,color) instead.
979  * @param {Number} t time in seconds
980  * @param {cc.Scene} scene
981  * @param {cc.Color} color
982  * @return {cc.TransitionFade}
983  */
984 cc.TransitionFade.create = function (t, scene, color) {
985     return new cc.TransitionFade(t, scene, color);
986 };
987 
988 /**
989  * Cross fades two scenes using the cc.RenderTexture object.
990  * @class
991  * @extends cc.TransitionScene
992  * @param {Number} t time in seconds
993  * @param {cc.Scene} scene
994  * @example
995  * var trans = new cc.TransitionCrossFade(time,scene);
996  */
997 cc.TransitionCrossFade = cc.TransitionScene.extend(/** @lends cc.TransitionCrossFade# */{
998     /**
999      * Constructor of TransitionCrossFade
1000      * @param {Number} t time in seconds
1001      * @param {cc.Scene} scene
1002      */
1003     ctor:function (t, scene) {
1004         cc.TransitionScene.prototype.ctor.call(this);
1005         scene && this.initWithDuration(t, scene);
1006     },
1007     /**
1008      * custom on enter
1009      */
1010     onEnter:function () {
1011         cc.TransitionScene.prototype.onEnter.call(this);
1012 
1013         // create a transparent color layer
1014         // in which we are going to add our rendertextures
1015         var color = cc.color(0, 0, 0, 0);
1016         var winSize = cc.director.getWinSize();
1017         var layer = new cc.LayerColor(color);
1018 
1019         // create the first render texture for inScene
1020         var inTexture = new cc.RenderTexture(winSize.width, winSize.height);
1021 
1022         inTexture.sprite.anchorX = 0.5;
1023 	    inTexture.sprite.anchorY = 0.5;
1024         inTexture.attr({
1025 	        x: winSize.width / 2,
1026 	        y: winSize.height / 2,
1027 	        anchorX: 0.5,
1028 	        anchorY: 0.5
1029         });
1030 
1031         // render inScene to its texturebuffer
1032         inTexture.begin();
1033         this._inScene.visit();
1034         inTexture.end();
1035 
1036         // create the second render texture for outScene
1037         var outTexture = new cc.RenderTexture(winSize.width, winSize.height);
1038         outTexture.setPosition(winSize.width / 2, winSize.height / 2);
1039 	    outTexture.sprite.anchorX = outTexture.anchorX = 0.5;
1040 	    outTexture.sprite.anchorY = outTexture.anchorY = 0.5;
1041 
1042         // render outScene to its texturebuffer
1043         outTexture.begin();
1044         this._outScene.visit();
1045         outTexture.end();
1046 
1047         inTexture.sprite.setBlendFunc(cc.ONE, cc.ONE);                                             // inScene will lay on background and will not be used with alpha
1048         outTexture.sprite.setBlendFunc(cc.SRC_ALPHA, cc.ONE_MINUS_SRC_ALPHA);                      // we are going to blend outScene via alpha
1049 
1050         // add render textures to the layer
1051         layer.addChild(inTexture);
1052         layer.addChild(outTexture);
1053 
1054         // initial opacity:
1055         inTexture.sprite.opacity = 255;
1056         outTexture.sprite.opacity = 255;
1057 
1058         // create the blend action
1059         var layerAction = cc.sequence(
1060             cc.fadeTo(this._duration, 0), cc.callFunc(this.hideOutShowIn, this),
1061             cc.callFunc(this.finish, this)
1062         );
1063 
1064         // run the blend action
1065         outTexture.sprite.runAction(layerAction);
1066 
1067         // add the layer (which contains our two rendertextures) to the scene
1068         this.addChild(layer, 2, cc.SCENE_FADE);
1069     },
1070 
1071     /**
1072      * custom on exit
1073      */
1074     onExit:function () {
1075         this.removeChildByTag(cc.SCENE_FADE, false);
1076         cc.TransitionScene.prototype.onExit.call(this);
1077     },
1078 
1079     /**
1080      * stuff gets drawn here
1081      */
1082     visit:function () {
1083         cc.Node.prototype.visit.call(this);
1084     },
1085 
1086     /**
1087      * overide draw
1088      */
1089     draw:function () {
1090         // override draw since both scenes (textures) are rendered in 1 scene
1091     }
1092 });
1093 
1094 /**
1095  * Cross fades two scenes using the cc.RenderTexture object.
1096  * @deprecated since v3.0,please use new cc.TransitionCrossFade(t, scene) instead.
1097  * @param {Number} t time in seconds
1098  * @param {cc.Scene} scene
1099  * @return {cc.TransitionCrossFade}
1100  */
1101 cc.TransitionCrossFade.create = function (t, scene) {
1102     return new cc.TransitionCrossFade(t, scene);
1103 };
1104 
1105 /**
1106  *  Turn off the tiles of the outgoing scene in random order
1107  * @class
1108  * @extends cc.TransitionScene
1109  * @param {Number} t time in seconds
1110  * @param {cc.Scene} scene
1111  * @example
1112  * var trans = new cc.TransitionTurnOffTiles(time,scene);
1113  */
1114 cc.TransitionTurnOffTiles = cc.TransitionScene.extend(/** @lends cc.TransitionTurnOffTiles# */{
1115     _gridProxy: null,
1116     /**
1117      * Constructor of TransitionCrossFade
1118      * @param {Number} t time in seconds
1119      * @param {cc.Scene} scene
1120      */
1121     ctor:function (t, scene) {
1122         cc.TransitionScene.prototype.ctor.call(this);
1123         this._gridProxy = new cc.NodeGrid();
1124         scene && this.initWithDuration(t, scene);
1125     },
1126 
1127     _sceneOrder:function () {
1128         this._isInSceneOnTop = false;
1129     },
1130 
1131     /**
1132      * custom on enter
1133      */
1134     onEnter:function () {
1135         cc.TransitionScene.prototype.onEnter.call(this);
1136         this._gridProxy.setTarget(this._outScene);
1137         this._gridProxy.onEnter();
1138 
1139         var winSize = cc.director.getWinSize();
1140         var aspect = winSize.width / winSize.height;
1141         var x = 0 | (12 * aspect);
1142         var y = 12;
1143         var toff = cc.turnOffTiles(this._duration, cc.size(x, y));
1144         var action = this.easeActionWithAction(toff);
1145         this._gridProxy.runAction(cc.sequence(action, cc.callFunc(this.finish, this), cc.stopGrid()));
1146     },
1147 
1148     visit: function(){
1149         this._inScene.visit();
1150         this._gridProxy.visit();
1151     },
1152 
1153     /**
1154      * @param {cc.ActionInterval} action
1155      * @return {cc.ActionInterval}
1156      */
1157     easeActionWithAction:function (action) {
1158         return action;
1159     }
1160 });
1161 
1162 /**
1163  *  Turn off the tiles of the outgoing scene in random order
1164  * @deprecated since v3.0,please use new cc.TransitionTurnOffTiles(t, scene) instead.
1165  * @param {Number} t time in seconds
1166  * @param {cc.Scene} scene
1167  * @return {cc.TransitionTurnOffTiles}
1168  */
1169 cc.TransitionTurnOffTiles.create = function (t, scene) {
1170     return new cc.TransitionTurnOffTiles(t, scene);
1171 };
1172 
1173 /**
1174  *  The odd columns goes upwards while the even columns goes downwards.
1175  * @class
1176  * @extends cc.TransitionScene
1177  * @param {Number} t time in seconds
1178  * @param {cc.Scene} scene
1179  * @example
1180  * var trans = new cc.TransitionSplitCols(time,scene);
1181  */
1182 cc.TransitionSplitCols = cc.TransitionScene.extend(/** @lends cc.TransitionSplitCols# */{
1183     _gridProxy: null,
1184 
1185     _switchTargetToInscene: function(){
1186         this._gridProxy.setTarget(this._inScene);
1187     },
1188 
1189     /**
1190      * Constructor of TransitionSplitCols
1191      * @param {Number} t time in seconds
1192      * @param {cc.Scene} scene
1193      */
1194     ctor:function (t, scene) {
1195         cc.TransitionScene.prototype.ctor.call(this);
1196         this._gridProxy = new cc.NodeGrid();
1197         scene && this.initWithDuration(t, scene);
1198     },
1199     /**
1200      * custom on enter
1201      */
1202     onEnter:function () {
1203         cc.TransitionScene.prototype.onEnter.call(this);
1204         //this._inScene.visible = false;
1205         this._gridProxy.setTarget(this._outScene);
1206         this._gridProxy.onEnter();
1207 
1208         var split = this.action();
1209         var seq = cc.sequence(
1210             split, cc.callFunc(this._switchTargetToInscene, this), split.reverse());
1211 
1212         this._gridProxy.runAction(
1213             cc.sequence(this.easeActionWithAction(seq), cc.callFunc(this.finish, this), cc.stopGrid())
1214         );
1215     },
1216 
1217     onExit: function(){
1218         this._gridProxy.setTarget(null);
1219         this._gridProxy.onExit();
1220         cc.TransitionScene.prototype.onExit.call(this);
1221     },
1222 
1223     visit: function(){
1224         this._gridProxy.visit();
1225     },
1226 
1227     /**
1228      * @param {cc.ActionInterval} action
1229      * @return {cc.EaseInOut}
1230      */
1231     easeActionWithAction:function (action) {
1232         return new cc.EaseInOut(action, 3.0);
1233     },
1234 
1235     /**
1236      * @return {*}
1237      */
1238     action:function () {
1239         return cc.splitCols(this._duration / 2.0, 3);
1240     }
1241 });
1242 
1243 /**
1244  * The odd columns goes upwards while the even columns goes downwards.
1245  * @deprecated since v3.0,please use new cc.TransitionSplitCols(t, scene) instead.
1246  * @param {Number} t time in seconds
1247  * @param {cc.Scene} scene
1248  * @return {cc.TransitionSplitCols}
1249  */
1250 cc.TransitionSplitCols.create = function (t, scene) {
1251     return new cc.TransitionSplitCols(t, scene);
1252 };
1253 
1254 /**
1255  *  The odd rows goes to the left while the even rows goes to the right.
1256  * @class
1257  * @extends cc.TransitionSplitCols
1258  * @param {Number} t time in seconds
1259  * @param {cc.Scene} scene
1260  * @example
1261  * var trans = new cc.TransitionSplitRows(time,scene);
1262  */
1263 cc.TransitionSplitRows = cc.TransitionSplitCols.extend(/** @lends cc.TransitionSplitRows# */{
1264 
1265     /**
1266      * Constructor of TransitionSplitRows
1267      * @param {Number} t time in seconds
1268      * @param {cc.Scene} scene
1269      */
1270     ctor:function (t, scene) {
1271         cc.TransitionSplitCols.prototype.ctor.call(this);
1272         scene && this.initWithDuration(t, scene);
1273     },
1274     /**
1275      * @return {*}
1276      */
1277     action:function () {
1278         return cc.splitRows(this._duration / 2.0, 3);
1279     }
1280 });
1281 
1282 /**
1283  * The odd rows goes to the left while the even rows goes to the right.
1284  * @deprecated since v3.0,please use new cc.TransitionSplitRows(t, scene) instead.
1285  * @param {Number} t time in seconds
1286  * @param {cc.Scene} scene
1287  * @return {cc.TransitionSplitRows}
1288  */
1289 cc.TransitionSplitRows.create = function (t, scene) {
1290     return new cc.TransitionSplitRows(t, scene);
1291 };
1292 
1293 /**
1294  *  Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner.
1295  * @class
1296  * @extends cc.TransitionScene
1297  * @param {Number} t time in seconds
1298  * @param {cc.Scene} scene
1299  * @example
1300  * var trans = new cc.TransitionFadeTR(time,scene);
1301  */
1302 cc.TransitionFadeTR = cc.TransitionScene.extend(/** @lends cc.TransitionFadeTR# */{
1303     _gridProxy: null,
1304     /**
1305      * Constructor of TransitionFadeTR
1306      * @param {Number} t time in seconds
1307      * @param {cc.Scene} scene
1308      */
1309     ctor:function (t, scene) {
1310         cc.TransitionScene.prototype.ctor.call(this);
1311         this._gridProxy = new cc.NodeGrid();
1312         scene && this.initWithDuration(t, scene);
1313     },
1314     _sceneOrder:function () {
1315         this._isInSceneOnTop = false;
1316     },
1317 
1318     /**
1319      * Custom on enter
1320      */
1321     onEnter:function () {
1322         cc.TransitionScene.prototype.onEnter.call(this);
1323 
1324         this._gridProxy.setTarget(this._outScene);
1325         this._gridProxy.onEnter();
1326 
1327         var winSize = cc.director.getWinSize();
1328         var aspect = winSize.width / winSize.height;
1329         var x = 0 | (12 * aspect);
1330         var y = 12;
1331 
1332         var action = this.actionWithSize(cc.size(x, y));
1333         this._gridProxy.runAction(
1334             cc.sequence(this.easeActionWithAction(action), cc.callFunc(this.finish, this), cc.stopGrid())
1335         );
1336     },
1337 
1338     visit: function(){
1339         this._inScene.visit();
1340         this._gridProxy.visit();
1341     },
1342 
1343     /**
1344      * @param {cc.ActionInterval} action
1345      * @return {cc.ActionInterval}
1346      */
1347     easeActionWithAction:function (action) {
1348         return action;
1349     },
1350 
1351     /**
1352      * @param {cc.Size} size
1353      * @return {*}
1354      */
1355     actionWithSize:function (size) {
1356         return cc.fadeOutTRTiles(this._duration, size);
1357     }
1358 });
1359 
1360 /**
1361  *  Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner.
1362  * @deprecated since v3.0 please use new cc.TransitionFadeTR(t, scene) instead.
1363  * @param {Number} t time in seconds
1364  * @param {cc.Scene} scene
1365  * @return {cc.TransitionFadeTR}
1366  */
1367 cc.TransitionFadeTR.create = function (t, scene) {
1368     return new cc.TransitionFadeTR(t, scene);
1369 };
1370 
1371 /**
1372  *  Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
1373  * @class
1374  * @extends cc.TransitionFadeTR
1375  * @param {Number} t time in seconds
1376  * @param {cc.Scene} scene
1377  * @example
1378  * var trans = new cc.TransitionFadeBL(time,scene)
1379  */
1380 cc.TransitionFadeBL = cc.TransitionFadeTR.extend(/** @lends cc.TransitionFadeBL# */{
1381     /**
1382      * Constructor of TransitionFadeBL
1383      * @param {Number} t time in seconds
1384      * @param {cc.Scene} scene
1385      */
1386     ctor:function (t, scene) {
1387         cc.TransitionFadeTR.prototype.ctor.call(this);
1388         scene && this.initWithDuration(t, scene);
1389     },
1390 
1391     /**
1392      * @param {cc.Size} size
1393      * @return {*}
1394      */
1395     actionWithSize:function (size) {
1396         return cc.fadeOutBLTiles(this._duration, size);
1397     }
1398 });
1399 
1400 /**
1401  * Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
1402  * @deprecated since v3.0,please use new cc.TransitionFadeBL(t, scene);
1403  * @param {Number} t time in seconds
1404  * @param {cc.Scene} scene
1405  * @return {cc.TransitionFadeBL}
1406  */
1407 cc.TransitionFadeBL.create = function (t, scene) {
1408     return new cc.TransitionFadeBL(t, scene);
1409 };
1410 
1411 /**
1412  * Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
1413  * @class
1414  * @extends cc.TransitionFadeTR
1415  * @param {Number} t time in seconds
1416  * @param {cc.Scene} scene
1417  * @example
1418  * var trans = new cc.TransitionFadeUp(time,scene);
1419  */
1420 cc.TransitionFadeUp = cc.TransitionFadeTR.extend(/** @lends cc.TransitionFadeUp# */{
1421 
1422     /**
1423      * Constructor of TransitionFadeUp
1424      * @function
1425      * @param {Number} t time in seconds
1426      * @param {cc.Scene} scene
1427      */
1428     ctor:function (t, scene) {
1429         cc.TransitionFadeTR.prototype.ctor.call(this);
1430         scene && this.initWithDuration(t, scene);
1431     },
1432 
1433     /**
1434      * @param {cc.Size} size
1435      * @return {cc.FadeOutUpTiles}
1436      */
1437     actionWithSize:function (size) {
1438         return new cc.FadeOutUpTiles(this._duration, size);
1439     }
1440 });
1441 
1442 /**
1443  * Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
1444  * @deprecated since v3.0,please use new cc.TransitionFadeUp(t, scene) instead.
1445  * @param {Number} t time in seconds
1446  * @param {cc.Scene} scene
1447  * @return {cc.TransitionFadeUp}
1448  */
1449 cc.TransitionFadeUp.create = function (t, scene) {
1450     return new cc.TransitionFadeUp(t, scene);
1451 };
1452 
1453 /**
1454  * Fade the tiles of the outgoing scene from the top to the bottom.
1455  * @class
1456  * @extends cc.TransitionFadeTR
1457  * @param {Number} t time in seconds
1458  * @param {cc.Scene} scene
1459  * @example
1460  * var trans = new cc.TransitionFadeDown(time,scene);
1461  */
1462 cc.TransitionFadeDown = cc.TransitionFadeTR.extend(/** @lends cc.TransitionFadeDown# */{
1463 
1464     /**
1465      * Constructor of TransitionFadeDown
1466      * @param {Number} t time in seconds
1467      * @param {cc.Scene} scene
1468      */
1469     ctor:function (t, scene) {
1470         cc.TransitionFadeTR.prototype.ctor.call(this);
1471         scene && this.initWithDuration(t, scene);
1472     },
1473 
1474     /**
1475      * @param {cc.Size} size
1476      * @return {*}
1477      */
1478     actionWithSize:function (size) {
1479         return cc.fadeOutDownTiles( this._duration, size);
1480     }
1481 });
1482 
1483 /**
1484  * Fade the tiles of the outgoing scene from the top to the bottom.
1485  * @deprecated since v3.0,please use new cc.TransitionFadeDown(t, scene) instead.
1486  * @param {Number} t time in seconds
1487  * @param {cc.Scene} scene
1488  * @return {cc.TransitionFadeDown}
1489  */
1490 cc.TransitionFadeDown.create = function (t, scene) {
1491     return new cc.TransitionFadeDown(t, scene);
1492 };
1493