123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989 |
- /****************************************************************************
- Copyright (c) 2008-2010 Ricardo Quesada
- Copyright (c) 2011-2012 cocos2d-x.org
- Copyright (c) 2013-2014 Chukong Technologies Inc.
- http://www.cocos2d-x.org
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- ****************************************************************************/
- /**
- * A tag constant for identifying fade scenes
- * @constant
- * @type Number
- */
- cc.SCENE_FADE = 4208917214;
- /**
- * horizontal orientation Type where the Left is nearer
- * @constant
- * @type Number
- */
- cc.TRANSITION_ORIENTATION_LEFT_OVER = 0;
- /**
- * horizontal orientation type where the Right is nearer
- * @constant
- * @type Number
- */
- cc.TRANSITION_ORIENTATION_RIGHT_OVER = 1;
- /**
- * vertical orientation type where the Up is nearer
- * @constant
- * @type Number
- */
- cc.TRANSITION_ORIENTATION_UP_OVER = 0;
- /**
- * vertical orientation type where the Bottom is nearer
- * @constant
- * @type Number
- */
- cc.TRANSITION_ORIENTATION_DOWN_OVER = 1;
- /**
- * @class
- * @extends cc.Scene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene the scene to transit with
- * @example
- * var trans = new TransitionScene(time,scene);
- */
- cc.TransitionScene = cc.Scene.extend(/** @lends cc.TransitionScene# */{
- _inScene:null,
- _outScene:null,
- _duration:null,
- _isInSceneOnTop:false,
- _isSendCleanupToScene:false,
- _className:"TransitionScene",
- /**
- * creates a base transition with duration and incoming scene
- * Constructor of cc.TransitionScene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene the scene to transit with
- */
- ctor:function (t, scene) {
- cc.Scene.prototype.ctor.call(this);
- if(t !== undefined && scene !== undefined)
- this.initWithDuration(t, scene);
- },
- //private
- _setNewScene:function (dt) {
- this.unschedule(this._setNewScene);
- // Before replacing, save the "send cleanup to scene"
- var director = cc.director;
- this._isSendCleanupToScene = director.isSendCleanupToScene();
- director.runScene(this._inScene);
- // enable events while transitions
- cc.eventManager.setEnabled(true);
- // issue #267
- this._outScene.visible = true;
- },
- //protected
- _sceneOrder:function () {
- this._isInSceneOnTop = true;
- },
- /**
- * stuff gets drawn here
- */
- draw:function () {
- if (this._isInSceneOnTop) {
- this._outScene.visit();
- this._inScene.visit();
- } else {
- this._inScene.visit();
- this._outScene.visit();
- }
- },
- /**
- * <p>
- * Event callback that is invoked every time when cc.TransitionScene enters the 'stage'. <br/>
- * If the TransitionScene enters the 'stage' with a transition, this event is called when the transition starts. <br/>
- * During onEnter you can't access a "sister/brother" node. <br/>
- * If you override onEnter, you must call its parent's onEnter function with this._super().
- * </p>
- */
- onEnter:function () {
- cc.Node.prototype.onEnter.call(this);
- // disable events while transitions
- cc.eventManager.setEnabled(false);
- // outScene should not receive the onEnter callback
- // only the onExitTransitionDidStart
- this._outScene.onExitTransitionDidStart();
- this._inScene.onEnter();
- },
- /**
- * <p>
- * callback that is called every time the cc.TransitionScene leaves the 'stage'. <br/>
- * If the cc.TransitionScene leaves the 'stage' with a transition, this callback is called when the transition finishes. <br/>
- * During onExit you can't access a sibling node. <br/>
- * If you override onExit, you shall call its parent's onExit with this._super().
- * </p>
- */
- onExit:function () {
- cc.Node.prototype.onExit.call(this);
- // enable events while transitions
- cc.eventManager.setEnabled(true);
- this._outScene.onExit();
- // _inScene should not receive the onEnter callback
- // only the onEnterTransitionDidFinish
- this._inScene.onEnterTransitionDidFinish();
- },
- /**
- * custom cleanup
- */
- cleanup:function () {
- cc.Node.prototype.cleanup.call(this);
- if (this._isSendCleanupToScene)
- this._outScene.cleanup();
- },
- /**
- * initializes a transition with duration and incoming scene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene a scene to transit to
- * @return {Boolean} return false if error
- */
- initWithDuration:function (t, scene) {
- if(!scene)
- throw "cc.TransitionScene.initWithDuration(): Argument scene must be non-nil";
- if (this.init()) {
- this._duration = t;
- this.attr({
- x: 0,
- y: 0,
- anchorX: 0,
- anchorY: 0
- });
- // retain
- this._inScene = scene;
- this._outScene = cc.director.getRunningScene();
- if (!this._outScene) {
- this._outScene = cc.Scene.create();
- this._outScene.init();
- }
- if(this._inScene == this._outScene)
- throw "cc.TransitionScene.initWithDuration(): Incoming scene must be different from the outgoing scene";
- this._sceneOrder();
- return true;
- } else {
- return false;
- }
- },
- /**
- * called after the transition finishes
- */
- finish:function () {
- // clean up
- this._inScene.attr({
- visible: true,
- x: 0,
- y: 0,
- scale: 1.0,
- rotation: 0.0
- });
- if(cc._renderType === cc._RENDER_TYPE_WEBGL)
- this._inScene.getCamera().restore();
- this._outScene.attr({
- visible: false,
- x: 0,
- y: 0,
- scale: 1.0,
- rotation: 0.0
- });
- if(cc._renderType === cc._RENDER_TYPE_WEBGL)
- this._outScene.getCamera().restore();
- //[self schedule:@selector(setNewScene:) interval:0];
- this.schedule(this._setNewScene, 0);
- },
- /**
- * set hide the out scene and show in scene
- */
- hideOutShowIn:function () {
- this._inScene.visible = true;
- this._outScene.visible = false;
- }
- });
- /**
- * creates a base transition with duration and incoming scene
- * @deprecated since v3.0, please use new cc.TransitionScene(t,scene) instead
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene the scene to transit with
- * @return {cc.TransitionScene|Null}
- */
- cc.TransitionScene.create = function (t, scene) {
- return new cc.TransitionScene(t, scene);
- };
- /**
- * A cc.Transition that supports orientation like.<br/>
- * Possible orientation: LeftOver, RightOver, UpOver, DownOver<br/>
- * useful for when you want to make a transition happen between 2 orientations
- * @class
- * @extends cc.TransitionScene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} orientation
- * @example
- * var trans = new cc.TransitionSceneOriented(time,scene,orientation);
- */
- cc.TransitionSceneOriented = cc.TransitionScene.extend(/** @lends cc.TransitionSceneOriented# */{
- _orientation:0,
- /**
- * Constructor of TransitionSceneOriented
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} orientation
- */
- ctor:function (t, scene, orientation) {
- cc.TransitionScene.prototype.ctor.call(this);
- orientation != undefined && this.initWithDuration(t, scene, orientation);
- },
- /**
- * initialize the transition
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} orientation
- * @return {Boolean}
- */
- initWithDuration:function (t, scene, orientation) {
- if (cc.TransitionScene.prototype.initWithDuration.call(this, t, scene)) {
- this._orientation = orientation;
- }
- return true;
- }
- });
- /**
- * creates a base transition with duration and incoming scene
- * @deprecated since v3.0 ,please use new cc.TransitionSceneOriented(t, scene, orientation) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} orientation
- * @return {cc.TransitionSceneOriented}
- * @example
- * // Example
- * var goHorizontal = cc.TransitionSceneOriented.create(0.5, thisScene, cc.TRANSITION_ORIENTATION_LEFT_OVER)
- */
- cc.TransitionSceneOriented.create = function (t, scene, orientation) {
- return new cc.TransitionSceneOriented(t, scene, orientation);
- };
- /**
- * Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming
- * @class
- * @extends cc.TransitionScene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionRotoZoom(t, scene);
- */
- cc.TransitionRotoZoom = cc.TransitionScene.extend(/** @lends cc.TransitionRotoZoom# */{
- /**
- * Constructor of TransitionRotoZoom
- * @function
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionScene.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- /**
- * Custom On Enter callback
- * @override
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- this._inScene.attr({
- scale: 0.001,
- anchorX: 0.5,
- anchorY: 0.5
- });
- this._outScene.attr({
- scale: 1.0,
- anchorX: 0.5,
- anchorY: 0.5
- });
- var rotoZoom = cc.sequence(
- cc.spawn(cc.scaleBy(this._duration / 2, 0.001),
- cc.rotateBy(this._duration / 2, 360 * 2)),
- cc.delayTime(this._duration / 2));
- this._outScene.runAction(rotoZoom);
- this._inScene.runAction(
- cc.sequence(rotoZoom.reverse(),
- cc.callFunc(this.finish, this)));
- }
- });
- /**
- * Creates a Transtion rotation and zoom
- * @deprecated since v3.0,please use new cc.TransitionRotoZoom(t, scene) instead
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene the scene to work with
- * @return {cc.TransitionRotoZoom}
- * @example
- * var RotoZoomTrans = cc.TransitionRotoZoom.create(2, nextScene);
- */
- cc.TransitionRotoZoom.create = function (t, scene) {
- return new cc.TransitionRotoZoom(t, scene);
- };
- /**
- * Zoom out and jump the outgoing scene, and then jump and zoom in the incoming
- * @class
- * @extends cc.TransitionScene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionJumpZoom(t, scene);
- */
- cc.TransitionJumpZoom = cc.TransitionScene.extend(/** @lends cc.TransitionJumpZoom# */{
- /**
- * Constructor of TransitionJumpZoom
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionScene.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- /**
- * Custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- var winSize = cc.director.getWinSize();
- this._inScene.attr({
- scale: 0.5,
- x: winSize.width,
- y: 0,
- anchorX: 0.5,
- anchorY: 0.5
- });
- this._outScene.anchorX = 0.5;
- this._outScene.anchorY = 0.5;
- var jump = cc.jumpBy(this._duration / 4, cc.p(-winSize.width, 0), winSize.width / 4, 2);
- var scaleIn = cc.scaleTo(this._duration / 4, 1.0);
- var scaleOut = cc.scaleTo(this._duration / 4, 0.5);
- var jumpZoomOut = cc.sequence(scaleOut, jump);
- var jumpZoomIn = cc.sequence(jump, scaleIn);
- var delay = cc.delayTime(this._duration / 2);
- this._outScene.runAction(jumpZoomOut);
- this._inScene.runAction(cc.sequence(delay, jumpZoomIn, cc.callFunc(this.finish, this)));
- }
- });
- /**
- * creates a scene transition that zooms then jump across the screen, the same for the incoming scene
- * @deprecated since v3.0,please use new cc.TransitionJumpZoom(t, scene);
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionJumpZoom}
- */
- cc.TransitionJumpZoom.create = function (t, scene) {
- return new cc.TransitionJumpZoom(t, scene);
- };
- /**
- * Move in from to the left the incoming scene.
- * @class
- * @extends cc.TransitionScene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionMoveInL(time,scene);
- */
- cc.TransitionMoveInL = cc.TransitionScene.extend(/** @lends cc.TransitionMoveInL# */{
- /**
- * Constructor of TransitionMoveInL
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionScene.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- /**
- * Custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- this.initScenes();
- var action = this.action();
- this._inScene.runAction(
- cc.sequence(this.easeActionWithAction(action), cc.callFunc(this.finish, this))
- );
- },
- /**
- * initializes the scenes
- */
- initScenes:function () {
- this._inScene.setPosition(-cc.director.getWinSize().width, 0);
- },
- /**
- * returns the action that will be performed
- */
- action:function () {
- return cc.moveTo(this._duration, cc.p(0, 0));
- },
- /**
- * creates an ease action from action
- * @param {cc.ActionInterval} action
- * @return {cc.EaseOut}
- */
- easeActionWithAction:function (action) {
- return new cc.EaseOut(action, 2.0);
- }
- });
- /**
- * creates an action that Move in from to the left the incoming scene.
- * @deprecated since v3.0,please use new cc.TransitionMoveInL(t, scene) instead
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionMoveInL}
- * @example
- * var MoveInLeft = cc.TransitionMoveInL.create(1, nextScene)
- */
- cc.TransitionMoveInL.create = function (t, scene) {
- return new cc.TransitionMoveInL(t, scene);
- };
- /**
- * Move in from to the right the incoming scene.
- * @class
- * @extends cc.TransitionMoveInL
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionMoveInR(time,scene);
- */
- cc.TransitionMoveInR = cc.TransitionMoveInL.extend(/** @lends cc.TransitionMoveInR# */{
- /**
- * Constructor of TransitionMoveInR
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionMoveInL.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- /**
- * Init function
- */
- initScenes:function () {
- this._inScene.setPosition(cc.director.getWinSize().width, 0);
- }
- });
- /**
- * create a scene transition that Move in from to the right the incoming scene.
- * @deprecated since v3.0,please use new cc.TransitionMoveInR(t, scene) instead
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionMoveInR}
- * @example
- * var MoveInRight = cc.TransitionMoveInR.create(1, nextScene)
- */
- cc.TransitionMoveInR.create = function (t, scene) {
- return new cc.TransitionMoveInR(t, scene);
- };
- /**
- * Move in from to the top the incoming scene.
- * @class
- * @extends cc.TransitionMoveInL
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionMoveInT(time,scene);
- */
- cc.TransitionMoveInT = cc.TransitionMoveInL.extend(/** @lends cc.TransitionMoveInT# */{
- /**
- * Constructor of TransitionMoveInT
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionMoveInL.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- /**
- * init function
- */
- initScenes:function () {
- this._inScene.setPosition(0, cc.director.getWinSize().height);
- }
- });
- /**
- * Move in from to the top the incoming scene.
- * @deprecated since v3.0,please use new cc.TransitionMoveInT(t, scene) instead
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionMoveInT}
- * @example
- * var MoveInTop = cc.TransitionMoveInT.create(1, nextScene)
- */
- cc.TransitionMoveInT.create = function (t, scene) {
- return new cc.TransitionMoveInT(t, scene);
- };
- /**
- * Move in from to the bottom the incoming scene.
- * @class
- * @extends cc.TransitionMoveInL
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionMoveInB(time,scene);
- */
- cc.TransitionMoveInB = cc.TransitionMoveInL.extend(/** @lends cc.TransitionMoveInB# */{
- /**
- * Constructor of TransitionMoveInB
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionMoveInL.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- /**
- * init function
- */
- initScenes:function () {
- this._inScene.setPosition(0, -cc.director.getWinSize().height);
- }
- });
- /**
- * create a scene transition that Move in from to the bottom the incoming scene.
- * @deprecated since v3.0,please use new cc.TransitionMoveInB(t, scene) instead
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionMoveInB}
- * @example
- * var MoveinB = cc.TransitionMoveInB.create(1, nextScene)
- */
- cc.TransitionMoveInB.create = function (t, scene) {
- return new cc.TransitionMoveInB(t, scene);
- };
- /**
- * The adjust factor is needed to prevent issue #442<br/>
- * One solution is to use DONT_RENDER_IN_SUBPIXELS images, but NO<br/>
- * The other issue is that in some transitions (and I don't know why)<br/>
- * the order should be reversed (In in top of Out or vice-versa).
- * @constant
- * @type Number
- */
- cc.ADJUST_FACTOR = 0.5;
- /**
- * a transition that a new scene is slided from left
- * @class
- * @extends cc.TransitionScene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = cc.TransitionSlideInL(time,scene);
- */
- cc.TransitionSlideInL = cc.TransitionScene.extend(/** @lends cc.TransitionSlideInL# */{
- /**
- * Constructor of TransitionSlideInL
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionScene.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- _sceneOrder:function () {
- this._isInSceneOnTop = false;
- },
- /**
- * custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- this.initScenes();
- var inA = this.action();
- var outA = this.action();
- var inAction = this.easeActionWithAction(inA);
- var outAction = cc.sequence(this.easeActionWithAction(outA), cc.callFunc(this.finish, this));
- this._inScene.runAction(inAction);
- this._outScene.runAction(outAction);
- },
- /**
- * initializes the scenes
- */
- initScenes:function () {
- this._inScene.setPosition(-cc.director.getWinSize().width + cc.ADJUST_FACTOR, 0);
- },
- /**
- * returns the action that will be performed by the incomming and outgoing scene
- * @return {cc.MoveBy}
- */
- action:function () {
- return cc.moveBy(this._duration, cc.p(cc.director.getWinSize().width - cc.ADJUST_FACTOR, 0));
- },
- /**
- * @param {cc.ActionInterval} action
- * @return {*}
- */
- easeActionWithAction:function (action) {
- return new cc.EaseInOut(action, 2.0);
- }
- });
- /**
- * create a transition that a new scene is slided from left
- * @deprecated since v3.0,please use new cc.TransitionSlideInL(t, scene) instead
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionSlideInL}
- * @example
- * var myTransition = cc.TransitionSlideInL.create(1.5, nextScene)
- */
- cc.TransitionSlideInL.create = function (t, scene) {
- return new cc.TransitionSlideInL(t, scene);
- };
- /**
- * Slide in the incoming scene from the right border.
- * @class
- * @extends cc.TransitionSlideInL
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionSlideInR(time,scene);
- */
- cc.TransitionSlideInR = cc.TransitionSlideInL.extend(/** @lends cc.TransitionSlideInR# */{
- /**
- * Constructor of TransitionSlideInR
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionSlideInL.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- _sceneOrder:function () {
- this._isInSceneOnTop = true;
- },
- /**
- * initializes the scenes
- */
- initScenes:function () {
- this._inScene.setPosition(cc.director.getWinSize().width - cc.ADJUST_FACTOR, 0);
- },
- /**
- * returns the action that will be performed by the incomming and outgoing scene
- * @return {cc.MoveBy}
- */
- action:function () {
- return cc.moveBy(this._duration, cc.p(-(cc.director.getWinSize().width - cc.ADJUST_FACTOR), 0));
- }
- });
- /**
- * create Slide in the incoming scene from the right border.
- * @deprecated since v3.0,please use new cc.TransitionSlideInR(t, scene) instead
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionSlideInR}
- * @example
- * var myTransition = cc.TransitionSlideInR.create(1.5, nextScene)
- */
- cc.TransitionSlideInR.create = function (t, scene) {
- return new cc.TransitionSlideInR(t, scene);
- };
- /**
- * Slide in the incoming scene from the bottom border.
- * @class
- * @extends cc.TransitionSlideInL
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionSlideInB(time,scene);
- */
- cc.TransitionSlideInB = cc.TransitionSlideInL.extend(/** @lends cc.TransitionSlideInB# */{
- /**
- * Constructor of TransitionSlideInB
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionSlideInL.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- _sceneOrder:function () {
- this._isInSceneOnTop = false;
- },
- /**
- * initializes the scenes
- */
- initScenes:function () {
- this._inScene.setPosition(0, -(cc.director.getWinSize().height - cc.ADJUST_FACTOR));
- },
- /**
- * returns the action that will be performed by the incomming and outgoing scene
- * @return {cc.MoveBy}
- */
- action:function () {
- return cc.moveBy(this._duration, cc.p(0, cc.director.getWinSize().height - cc.ADJUST_FACTOR));
- }
- });
- /**
- * create a Slide in the incoming scene from the bottom border.
- * @deprecated since v3.0,please use new cc.TransitionSlideInB(t, scene) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionSlideInB}
- * @example
- * var myTransition = cc.TransitionSlideInB.create(1.5, nextScene)
- */
- cc.TransitionSlideInB.create = function (t, scene) {
- return new cc.TransitionSlideInB(t, scene);
- };
- /**
- * Slide in the incoming scene from the top border.
- * @class
- * @extends cc.TransitionSlideInL
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionSlideInT(time,scene);
- */
- cc.TransitionSlideInT = cc.TransitionSlideInL.extend(/** @lends cc.TransitionSlideInT# */{
- /**
- * Constructor of TransitionSlideInT
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionSlideInL.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- _sceneOrder:function () {
- this._isInSceneOnTop = true;
- },
- /**
- * initializes the scenes
- */
- initScenes:function () {
- this._inScene.setPosition(0, cc.director.getWinSize().height - cc.ADJUST_FACTOR);
- },
- /**
- * returns the action that will be performed by the incomming and outgoing scene
- * @return {cc.MoveBy}
- */
- action:function () {
- return cc.moveBy(this._duration, cc.p(0, -(cc.director.getWinSize().height - cc.ADJUST_FACTOR)));
- }
- });
- /**
- * create a Slide in the incoming scene from the top border.
- * @deprecated since v3.0,please use new cc.TransitionSlideInT(t, scene) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionSlideInT}
- * @example
- * var myTransition = cc.TransitionSlideInT.create(1.5, nextScene)
- */
- cc.TransitionSlideInT.create = function (t, scene) {
- return new cc.TransitionSlideInT(t, scene);
- };
- /**
- * Shrink the outgoing scene while grow the incoming scene
- * @class
- * @extends cc.TransitionScene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionShrinkGrow(time,scene);
- */
- cc.TransitionShrinkGrow = cc.TransitionScene.extend(/** @lends cc.TransitionShrinkGrow# */{
- /**
- * Constructor of TransitionShrinkGrow
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionScene.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- /**
- * Custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- this._inScene.attr({
- scale: 0.001,
- anchorX: 2 / 3.0,
- anchorY: 0.5
- });
- this._outScene.attr({
- scale: 1.0,
- anchorX: 1 / 3.0,
- anchorY: 0.5
- });
- var scaleOut = cc.scaleTo(this._duration, 0.01);
- var scaleIn = cc.scaleTo(this._duration, 1.0);
- this._inScene.runAction(this.easeActionWithAction(scaleIn));
- this._outScene.runAction(
- cc.sequence(this.easeActionWithAction(scaleOut), cc.callFunc(this.finish, this))
- );
- },
- /**
- * @param action
- * @return {cc.EaseOut}
- */
- easeActionWithAction:function (action) {
- return new cc.EaseOut(action, 2.0);
- }
- });
- /**
- * Shrink the outgoing scene while grow the incoming scene
- * @deprecated since v3.0,please use new cc.TransitionShrinkGrow(t, scene) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionShrinkGrow}
- * @example
- * var myTransition = cc.TransitionShrinkGrow.create(1.5, nextScene)
- */
- cc.TransitionShrinkGrow.create = function (t, scene) {
- return new cc.TransitionShrinkGrow(t, scene);
- };
- /**
- * Flips the screen horizontally.<br/>
- * The front face is the outgoing scene and the back face is the incoming scene.
- * @class
- * @extends cc.TransitionSceneOriented
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- * @example
- * var trans = new cc.TransitionFlipX(t,scene,o);
- */
- cc.TransitionFlipX = cc.TransitionSceneOriented.extend(/** @lends cc.TransitionFlipX# */{
- /**
- * Constructor of TransitionFlipX
- * @function
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- */
- ctor:function (t, scene, o) {
- cc.TransitionSceneOriented.prototype.ctor.call(this);
- o = o || cc.TRANSITION_ORIENTATION_RIGHT_OVER;
- scene && this.initWithDuration(t, scene, o);
- },
- /**
- * custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- var inA, outA;
- this._inScene.visible = false;
- var inDeltaZ, inAngleZ, outDeltaZ, outAngleZ;
- if (this._orientation === cc.TRANSITION_ORIENTATION_RIGHT_OVER) {
- inDeltaZ = 90;
- inAngleZ = 270;
- outDeltaZ = 90;
- outAngleZ = 0;
- } else {
- inDeltaZ = -90;
- inAngleZ = 90;
- outDeltaZ = -90;
- outAngleZ = 0;
- }
- inA = cc.sequence(
- cc.delayTime(this._duration / 2), cc.show(),
- cc.orbitCamera(this._duration / 2, 1, 0, inAngleZ, inDeltaZ, 0, 0),
- cc.callFunc(this.finish, this)
- );
- outA = cc.sequence(
- cc.orbitCamera(this._duration / 2, 1, 0, outAngleZ, outDeltaZ, 0, 0),
- cc.hide(), cc.delayTime(this._duration / 2)
- );
- this._inScene.runAction(inA);
- this._outScene.runAction(outA);
- }
- });
- /**
- * Flips the screen horizontally.<br/>
- * The front face is the outgoing scene and the back face is the incoming scene.
- * @deprecated since v3.0,please use new cc.TransitionFlipX(t, scene,o) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- * @return {cc.TransitionFlipX}
- * @example
- * var myTransition = cc.TransitionFlipX.create(1.5, nextScene) //default is cc.TRANSITION_ORIENTATION_RIGHT_OVER
- * //OR
- * var myTransition = cc.TransitionFlipX.create(1.5, nextScene, cc.TRANSITION_ORIENTATION_UP_OVER)
- */
- cc.TransitionFlipX.create = function (t, scene, o) {
- return new cc.TransitionFlipX(t, scene, o);
- };
- /**
- * Flips the screen vertically.<br/>
- * The front face is the outgoing scene and the back face is the incoming scene.
- * @class
- * @extends cc.TransitionSceneOriented
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- * @example
- * var trans = new cc.TransitionFlipY(time,scene,0);
- */
- cc.TransitionFlipY = cc.TransitionSceneOriented.extend(/** @lends cc.TransitionFlipY# */{
- /**
- * Constructor of TransitionFlipY
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- */
- ctor:function (t, scene, o) {
- cc.TransitionSceneOriented.prototype.ctor.call(this);
- o = o || cc.TRANSITION_ORIENTATION_UP_OVER;
- scene && this.initWithDuration(t, scene, o);
- },
- /**
- * custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- var inA, outA;
- this._inScene.visible = false;
- var inDeltaZ, inAngleZ, outDeltaZ, outAngleZ;
- if (this._orientation == cc.TRANSITION_ORIENTATION_UP_OVER) {
- inDeltaZ = 90;
- inAngleZ = 270;
- outDeltaZ = 90;
- outAngleZ = 0;
- } else {
- inDeltaZ = -90;
- inAngleZ = 90;
- outDeltaZ = -90;
- outAngleZ = 0;
- }
- inA = cc.Sequence.create(
- cc.DelayTime.create(this._duration / 2), cc.Show.create(),
- cc.OrbitCamera.create(this._duration / 2, 1, 0, inAngleZ, inDeltaZ, 90, 0),
- cc.CallFunc.create(this.finish, this)
- );
- outA = cc.Sequence.create(
- cc.OrbitCamera.create(this._duration / 2, 1, 0, outAngleZ, outDeltaZ, 90, 0),
- cc.Hide.create(), cc.DelayTime.create(this._duration / 2)
- );
- this._inScene.runAction(inA);
- this._outScene.runAction(outA);
- }
- });
- /**
- * Flips the screen vertically.<br/>
- * The front face is the outgoing scene and the back face is the incoming scene.
- * @deprecated since v3.0,please use new cc.TransitionFlipY(t, scene,o) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- * @return {cc.TransitionFlipY}
- * @example
- * var myTransition = cc.TransitionFlipY.create(1.5, nextScene)//default is cc.TRANSITION_ORIENTATION_UP_OVER
- * //OR
- * var myTransition = cc.TransitionFlipY.create(1.5, nextScene, cc.TRANSITION_ORIENTATION_RIGHT_OVER)
- */
- cc.TransitionFlipY.create = function (t, scene, o) {
- return new cc.TransitionFlipY(t, scene, o);
- };
- /**
- * Flips the screen half horizontally and half vertically.<br/>
- * The front face is the outgoing scene and the back face is the incoming scene.
- * @class
- * @extends cc.TransitionSceneOriented
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- * @example
- * var trans = cc.TransitionFlipAngular(time,scene,o);
- */
- cc.TransitionFlipAngular = cc.TransitionSceneOriented.extend(/** @lends cc.TransitionFlipAngular# */{
- /**
- * Constructor of TransitionFlipAngular
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- */
- ctor:function (t, scene, o) {
- cc.TransitionSceneOriented.prototype.ctor.call(this);
- o = o || cc.TRANSITION_ORIENTATION_RIGHT_OVER;
- scene && this.initWithDuration(t, scene, o);
- },
- /**
- * custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- var inA, outA;
- this._inScene.visible = false;
- var inDeltaZ, inAngleZ, outDeltaZ, outAngleZ;
- if (this._orientation === cc.TRANSITION_ORIENTATION_RIGHT_OVER) {
- inDeltaZ = 90;
- inAngleZ = 270;
- outDeltaZ = 90;
- outAngleZ = 0;
- } else {
- inDeltaZ = -90;
- inAngleZ = 90;
- outDeltaZ = -90;
- outAngleZ = 0;
- }
- inA = cc.sequence(
- cc.delayTime(this._duration / 2), cc.show(),
- cc.orbitCamera(this._duration / 2, 1, 0, inAngleZ, inDeltaZ, -45, 0),
- cc.callFunc(this.finish, this)
- );
- outA = cc.sequence(
- cc.orbitCamera(this._duration / 2, 1, 0, outAngleZ, outDeltaZ, 45, 0),
- cc.hide(), cc.delayTime(this._duration / 2)
- );
- this._inScene.runAction(inA);
- this._outScene.runAction(outA);
- }
- });
- /**
- * Flips the screen half horizontally and half vertically.<br/>
- * The front face is the outgoing scene and the back face is the incoming scene.
- * @deprecated since v3.0,please use new new cc.TransitionFlipAngular(t, scene, o) instead
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- * @return {cc.TransitionFlipAngular}
- * @example
- * var myTransition = cc.TransitionFlipAngular.create(1.5, nextScene)//default is cc.TRANSITION_ORIENTATION_RIGHT_OVER
- * //or
- * var myTransition = cc.TransitionFlipAngular.create(1.5, nextScene, cc.TRANSITION_ORIENTATION_DOWN_OVER)
- */
- cc.TransitionFlipAngular.create = function (t, scene, o) {
- return new cc.TransitionFlipAngular(t, scene, o);
- };
- /**
- * Flips the screen horizontally doing a zoom out/in<br/>
- * The front face is the outgoing scene and the back face is the incoming scene.
- * @class
- * @extends cc.TransitionSceneOriented
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- * @example
- * var trans = new cc.TransitionZoomFlipX(time,scene,o);
- */
- cc.TransitionZoomFlipX = cc.TransitionSceneOriented.extend(/** @lends cc.TransitionZoomFlipX# */{
- /**
- * Constructor of TransitionZoomFlipX
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- */
- ctor:function (t, scene, o) {
- cc.TransitionSceneOriented.prototype.ctor.call(this);
- o = o || cc.TRANSITION_ORIENTATION_RIGHT_OVER;
- scene && this.initWithDuration(t, scene, o);
- },
- /**
- * custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- var inA, outA;
- this._inScene.visible = false;
- var inDeltaZ, inAngleZ, outDeltaZ, outAngleZ;
- if (this._orientation === cc.TRANSITION_ORIENTATION_RIGHT_OVER) {
- inDeltaZ = 90;
- inAngleZ = 270;
- outDeltaZ = 90;
- outAngleZ = 0;
- } else {
- inDeltaZ = -90;
- inAngleZ = 90;
- outDeltaZ = -90;
- outAngleZ = 0;
- }
- inA = cc.sequence(
- cc.delayTime(this._duration / 2),
- cc.spawn(
- cc.orbitCamera(this._duration / 2, 1, 0, inAngleZ, inDeltaZ, 0, 0),
- cc.scaleTo(this._duration / 2, 1), cc.show()),
- cc.callFunc(this.finish, this)
- );
- outA = cc.sequence(
- cc.spawn(
- cc.orbitCamera(this._duration / 2, 1, 0, outAngleZ, outDeltaZ, 0, 0),
- cc.scaleTo(this._duration / 2, 0.5)),
- cc.hide(),
- cc.delayTime(this._duration / 2)
- );
- this._inScene.scale = 0.5;
- this._inScene.runAction(inA);
- this._outScene.runAction(outA);
- }
- });
- /**
- * Flips the screen horizontally doing a zoom out/in<br/>
- * The front face is the outgoing scene and the back face is the incoming scene.
- * @deprecated since v3.0,please use new new cc.TransitionZoomFlipX(t, scene, o) instead
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- * @return {cc.TransitionZoomFlipX}
- * @example
- * var myTransition = cc.TransitionZoomFlipX.create(1.5, nextScene)//default is cc.TRANSITION_ORIENTATION_RIGHT_OVER
- * //OR
- * var myTransition = cc.TransitionZoomFlipX.create(1.5, nextScene, cc.TRANSITION_ORIENTATION_DOWN_OVER)
- */
- cc.TransitionZoomFlipX.create = function (t, scene, o) {
- return new cc.TransitionZoomFlipX(t, scene, o);
- };
- /**
- * Flips the screen vertically doing a little zooming out/in<br/>
- * The front face is the outgoing scene and the back face is the incoming scene.
- * @class
- * @extends cc.TransitionSceneOriented
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- * @example
- * var trans = new cc.TransitionZoomFlipY(t,scene,o);
- */
- cc.TransitionZoomFlipY = cc.TransitionSceneOriented.extend(/** @lends cc.TransitionZoomFlipY# */{
- /**
- * Constructor of TransitionZoomFlipY
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- */
- ctor:function (t, scene, o) {
- cc.TransitionSceneOriented.prototype.ctor.call(this);
- o = o || cc.TRANSITION_ORIENTATION_UP_OVER;
- scene && this.initWithDuration(t, scene, o);
- },
- /**
- * custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- var inA, outA;
- this._inScene.visible = false;
- var inDeltaZ, inAngleZ, outDeltaZ, outAngleZ;
- if (this._orientation === cc.TRANSITION_ORIENTATION_UP_OVER) {
- inDeltaZ = 90;
- inAngleZ = 270;
- outDeltaZ = 90;
- outAngleZ = 0;
- } else {
- inDeltaZ = -90;
- inAngleZ = 90;
- outDeltaZ = -90;
- outAngleZ = 0;
- }
- inA = cc.sequence(
- cc.delayTime(this._duration / 2),
- cc.spawn(
- cc.orbitCamera(this._duration / 2, 1, 0, inAngleZ, inDeltaZ, 90, 0),
- cc.scaleTo(this._duration / 2, 1), cc.show()),
- cc.callFunc(this.finish, this));
- outA = cc.sequence(
- cc.spawn(
- cc.orbitCamera(this._duration / 2, 1, 0, outAngleZ, outDeltaZ, 90, 0),
- cc.scaleTo(this._duration / 2, 0.5)),
- cc.hide(), cc.delayTime(this._duration / 2));
- this._inScene.scale = 0.5;
- this._inScene.runAction(inA);
- this._outScene.runAction(outA);
- }
- });
- /**
- * Flips the screen vertically doing a little zooming out/in<br/>
- * The front face is the outgoing scene and the back face is the incoming scene.
- * @deprecated since v3.0,please use new new cc.TransitionZoomFlipY(t, scene, o) instead
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- * @return {cc.TransitionZoomFlipY}
- * @example
- * var myTransition = cc.TransitionZoomFlipY.create(1.5, nextScene)//default is cc.TRANSITION_ORIENTATION_UP_OVER
- * //OR
- * var myTransition = cc.TransitionZoomFlipY.create(1.5, nextScene, cc.TRANSITION_ORIENTATION_DOWN_OVER)
- */
- cc.TransitionZoomFlipY.create = function (t, scene, o) {
- return new cc.TransitionZoomFlipY(t, scene, o);
- };
- /**
- * Flips the screen half horizontally and half vertically doing a little zooming out/in.<br/>
- * The front face is the outgoing scene and the back face is the incoming scene.
- * @class
- * @extends cc.TransitionSceneOriented
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- * @example
- * var trans = new cc.TransitionZoomFlipAngular(time,scene,o);
- */
- cc.TransitionZoomFlipAngular = cc.TransitionSceneOriented.extend(/** @lends cc.TransitionZoomFlipAngular# */{
- /**
- * Constructor of TransitionZoomFlipAngular
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- */
- ctor:function (t, scene, o) {
- cc.TransitionSceneOriented.prototype.ctor.call(this);
- o = o || cc.TRANSITION_ORIENTATION_RIGHT_OVER;
- scene && this.initWithDuration(t, scene, o);
- },
- /**
- * custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- var inA, outA;
- this._inScene.visible = false;
- var inDeltaZ, inAngleZ, outDeltaZ, outAngleZ;
- if (this._orientation === cc.TRANSITION_ORIENTATION_RIGHT_OVER) {
- inDeltaZ = 90;
- inAngleZ = 270;
- outDeltaZ = 90;
- outAngleZ = 0;
- } else {
- inDeltaZ = -90;
- inAngleZ = 90;
- outDeltaZ = -90;
- outAngleZ = 0;
- }
- inA = cc.sequence(
- cc.delayTime(this._duration / 2),
- cc.spawn(
- cc.orbitCamera(this._duration / 2, 1, 0, inAngleZ, inDeltaZ, -45, 0),
- cc.scaleTo(this._duration / 2, 1), cc.show()),
- cc.show(),
- cc.callFunc(this.finish, this));
- outA = cc.sequence(
- cc.spawn(
- cc.orbitCamera(this._duration / 2, 1, 0, outAngleZ, outDeltaZ, 45, 0),
- cc.scaleTo(this._duration / 2, 0.5)),
- cc.hide(), cc.delayTime(this._duration / 2));
- this._inScene.scale = 0.5;
- this._inScene.runAction(inA);
- this._outScene.runAction(outA);
- }
- });
- /**
- * Flips the screen half horizontally and half vertically doing a little zooming out/in.<br/>
- * The front face is the outgoing scene and the back face is the incoming scene.
- * @deprecated since v3.0,please use new new cc.TransitionZoomFlipAngular(t, scene, o) instead
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- * @return {cc.TransitionZoomFlipAngular}
- * @example
- * var myTransition = cc.TransitionZoomFlipAngular.create(1.5, nextScene)//default is cc.TRANSITION_ORIENTATION_RIGHT_OVER
- * //OR
- * var myTransition = cc.TransitionZoomFlipAngular.create(1.5, nextScene, cc.TRANSITION_ORIENTATION_DOWN_OVER)
- */
- cc.TransitionZoomFlipAngular.create = function (t, scene, o) {
- return new cc.TransitionZoomFlipAngular(t, scene, o);
- };
- /**
- * Fade out the outgoing scene and then fade in the incoming scene.
- * @class
- * @extends cc.TransitionScene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- * @example
- * var trans = new cc.TransitionFade(time,scene,color)
- */
- cc.TransitionFade = cc.TransitionScene.extend(/** @lends cc.TransitionFade# */{
- _color:null,
- /**
- * Constructor of TransitionFade
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.TRANSITION_ORIENTATION_LEFT_OVER|cc.TRANSITION_ORIENTATION_RIGHT_OVER|cc.TRANSITION_ORIENTATION_UP_OVER|cc.TRANSITION_ORIENTATION_DOWN_OVER} o
- */
- ctor:function (t, scene, color) {
- cc.TransitionScene.prototype.ctor.call(this);
- this._color = cc.color();
- scene && this.initWithDuration(t, scene, color);
- },
- /**
- * custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- var l = new cc.LayerColor(this._color);
- this._inScene.visible = false;
- this.addChild(l, 2, cc.SCENE_FADE);
- var f = this.getChildByTag(cc.SCENE_FADE);
- var a = cc.sequence(
- cc.fadeIn(this._duration / 2),
- cc.callFunc(this.hideOutShowIn, this),
- cc.fadeOut(this._duration / 2),
- cc.callFunc(this.finish, this)
- );
- f.runAction(a);
- },
- /**
- * custom on exit
- */
- onExit:function () {
- cc.TransitionScene.prototype.onExit.call(this);
- this.removeChildByTag(cc.SCENE_FADE, false);
- },
- /**
- * initializes the transition with a duration and with an RGB color
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.Color} color
- * @return {Boolean}
- */
- initWithDuration:function (t, scene, color) {
- color = color || cc.color.BLACK;
- if (cc.TransitionScene.prototype.initWithDuration.call(this, t, scene)) {
- this._color.r = color.r;
- this._color.g = color.g;
- this._color.b = color.b;
- this._color.a = 0;
- }
- return true;
- }
- });
- /**
- * Fade out the outgoing scene and then fade in the incoming scene.
- * @deprecated since v3.0,please use new cc.TransitionFade(time,scene,color) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @param {cc.Color} color
- * @return {cc.TransitionFade}
- * @example
- * var myTransition = cc.TransitionFade.create(1.5, nextScene, cc.color(255,0,0))//fade to red
- */
- cc.TransitionFade.create = function (t, scene, color) {
- return new cc.TransitionFade(t, scene, color);
- };
- /**
- * Cross fades two scenes using the cc.RenderTexture object.
- * @class
- * @extends cc.TransitionScene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionCrossFade(time,scene);
- */
- cc.TransitionCrossFade = cc.TransitionScene.extend(/** @lends cc.TransitionCrossFade# */{
- /**
- * Constructor of TransitionCrossFade
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionScene.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- /**
- * custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- // create a transparent color layer
- // in which we are going to add our rendertextures
- var color = cc.color(0, 0, 0, 0);
- var winSize = cc.director.getWinSize();
- var layer = cc.LayerColor.create(color);
- // create the first render texture for inScene
- var inTexture = cc.RenderTexture.create(winSize.width, winSize.height);
- if (null == inTexture)
- return;
- inTexture.sprite.anchorX = 0.5;
- inTexture.sprite.anchorY = 0.5;
- inTexture.attr({
- x: winSize.width / 2,
- y: winSize.height / 2,
- anchorX: 0.5,
- anchorY: 0.5
- });
- // render inScene to its texturebuffer
- inTexture.begin();
- this._inScene.visit();
- inTexture.end();
- // create the second render texture for outScene
- var outTexture = cc.RenderTexture.create(winSize.width, winSize.height);
- outTexture.setPosition(winSize.width / 2, winSize.height / 2);
- outTexture.sprite.anchorX = outTexture.anchorX = 0.5;
- outTexture.sprite.anchorY = outTexture.anchorY = 0.5;
- // render outScene to its texturebuffer
- outTexture.begin();
- this._outScene.visit();
- outTexture.end();
- inTexture.sprite.setBlendFunc(cc.ONE, cc.ONE); // inScene will lay on background and will not be used with alpha
- outTexture.sprite.setBlendFunc(cc.SRC_ALPHA, cc.ONE_MINUS_SRC_ALPHA); // we are going to blend outScene via alpha
- // add render textures to the layer
- layer.addChild(inTexture);
- layer.addChild(outTexture);
- // initial opacity:
- inTexture.sprite.opacity = 255;
- outTexture.sprite.opacity = 255;
- // create the blend action
- var layerAction = cc.sequence(
- cc.fadeTo(this._duration, 0), cc.callFunc(this.hideOutShowIn, this),
- cc.callFunc(this.finish, this)
- );
- // run the blend action
- outTexture.sprite.runAction(layerAction);
- // add the layer (which contains our two rendertextures) to the scene
- this.addChild(layer, 2, cc.SCENE_FADE);
- },
- /**
- * custom on exit
- */
- onExit:function () {
- this.removeChildByTag(cc.SCENE_FADE, false);
- cc.TransitionScene.prototype.onExit.call(this);
- },
- /**
- * overide draw
- */
- draw:function () {
- // override draw since both scenes (textures) are rendered in 1 scene
- }
- });
- /**
- * Cross fades two scenes using the cc.RenderTexture object.
- * @deprecated since v3.0,please use new cc.TransitionCrossFade(t, scene) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionCrossFade}
- * @example
- * var myTransition = cc.TransitionCrossFade.create(1.5, nextScene)
- */
- cc.TransitionCrossFade.create = function (t, scene) {
- return new cc.TransitionCrossFade(t, scene);
- };
- /**
- * Turn off the tiles of the outgoing scene in random order
- * @class
- * @extends cc.TransitionScene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionTurnOffTiles(time,scene);
- */
- cc.TransitionTurnOffTiles = cc.TransitionScene.extend(/** @lends cc.TransitionTurnOffTiles# */{
- /**
- * Constructor of TransitionCrossFade
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionScene.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- _sceneOrder:function () {
- this._isInSceneOnTop = false;
- },
- /**
- * custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- var winSize = cc.director.getWinSize();
- var aspect = winSize.width / winSize.height;
- var x = 0 | (12 * aspect);
- var y = 12;
- var toff = cc.turnOffTiles(this._duration, cc.size(x, y));
- var action = this.easeActionWithAction(toff);
- this._outScene.runAction(cc.sequence(action, cc.callFunc(this.finish, this), cc.stopGrid()));
- },
- /**
- * @param {cc.ActionInterval} action
- * @return {cc.ActionInterval}
- */
- easeActionWithAction:function (action) {
- return action;
- }
- });
- /**
- * Turn off the tiles of the outgoing scene in random order
- * @deprecated since v3.0,please use new cc.TransitionTurnOffTiles(t, scene) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionTurnOffTiles}
- * @example
- * var myTransition = cc.TransitionTurnOffTiles.create(1.5, nextScene)
- */
- cc.TransitionTurnOffTiles.create = function (t, scene) {
- return new cc.TransitionTurnOffTiles(t, scene);
- };
- /**
- * The odd columns goes upwards while the even columns goes downwards.
- * @class
- * @extends cc.TransitionScene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionSplitCols(time,scene);
- */
- cc.TransitionSplitCols = cc.TransitionScene.extend(/** @lends cc.TransitionSplitCols# */{
- /**
- * Constructor of TransitionSplitCols
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionScene.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- /**
- * custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- this._inScene.visible = false;
- var split = this.action();
- var seq = cc.sequence(
- split, cc.callFunc(this.hideOutShowIn, this), split.reverse());
- this.runAction(
- cc.sequence(this.easeActionWithAction(seq), cc.callFunc(this.finish, this), cc.stopGrid())
- );
- },
- /**
- * @param {cc.ActionInterval} action
- * @return {cc.EaseInOut}
- */
- easeActionWithAction:function (action) {
- return new cc.EaseInOut(action, 3.0);
- },
- /**
- * @return {*}
- */
- action:function () {
- return cc.splitCols(this._duration / 2.0, 3);
- }
- });
- /**
- * The odd columns goes upwards while the even columns goes downwards.
- * @deprecated since v3.0,please use new cc.TransitionSplitCols(t, scene) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionSplitCols}
- * @example
- * var myTransition = cc.TransitionSplitCols.create(1.5, nextScene)
- */
- cc.TransitionSplitCols.create = function (t, scene) {
- return new cc.TransitionSplitCols(t, scene);
- };
- /**
- * The odd rows goes to the left while the even rows goes to the right.
- * @class
- * @extends cc.TransitionSplitCols
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionSplitRows(time,scene);
- */
- cc.TransitionSplitRows = cc.TransitionSplitCols.extend(/** @lends cc.TransitionSplitRows# */{
- /**
- * Constructor of TransitionSplitRows
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionSplitCols.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- /**
- * @return {*}
- */
- action:function () {
- return cc.splitRows(this._duration / 2.0, 3);
- }
- });
- /**
- * The odd rows goes to the left while the even rows goes to the right.
- * @deprecated since v3.0,please use new cc.TransitionSplitRows(t, scene) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionSplitRows}
- * @example
- * var myTransition = cc.TransitionSplitRows.create(1.5, nextScene)
- */
- cc.TransitionSplitRows.create = function (t, scene) {
- return new cc.TransitionSplitRows(t, scene);
- };
- /**
- * Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner.
- * @class
- * @extends cc.TransitionScene
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionFadeTR(time,scene);
- */
- cc.TransitionFadeTR = cc.TransitionScene.extend(/** @lends cc.TransitionFadeTR# */{
- /**
- * Constructor of TransitionFadeTR
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionScene.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- _sceneOrder:function () {
- this._isInSceneOnTop = false;
- },
- /**
- * Custom on enter
- */
- onEnter:function () {
- cc.TransitionScene.prototype.onEnter.call(this);
- var winSize = cc.director.getWinSize();
- var aspect = winSize.width / winSize.height;
- var x = 0 | (12 * aspect);
- var y = 12;
- var action = this.actionWithSize(cc.size(x, y));
- this._outScene.runAction(
- cc.Sequence.create(this.easeActionWithAction(action), cc.CallFunc.create(this.finish, this),
- cc.StopGrid.create())
- );
- },
- /**
- * @param {cc.ActionInterval} action
- * @return {cc.ActionInterval}
- */
- easeActionWithAction:function (action) {
- return action;
- },
- /**
- * @param {cc.Size} size
- * @return {*}
- */
- actionWithSize:function (size) {
- return cc.fadeOutTRTiles(this._duration, size);
- }
- });
- /**
- * Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner.
- * @deprecated since v3.0 please use new cc.TransitionFadeTR(t, scene) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionFadeTR}
- * @example
- * var myTransition = cc.TransitionFadeTR.create(1.5, nextScene)
- */
- cc.TransitionFadeTR.create = function (t, scene) {
- return new cc.TransitionFadeTR(t, scene);
- };
- /**
- * Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
- * @class
- * @extends cc.TransitionFadeTR
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionFadeBL(time,scene)
- */
- cc.TransitionFadeBL = cc.TransitionFadeTR.extend(/** @lends cc.TransitionFadeBL# */{
- /**
- * Constructor of TransitionFadeBL
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionFadeTR.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- /**
- * @param {cc.Size} size
- * @return {*}
- */
- actionWithSize:function (size) {
- return cc.fadeOutBLTiles(this._duration, size);
- }
- });
- /**
- * Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
- * @deprecated since v3.0,please use new cc.TransitionFadeBL(t, scene);
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionFadeBL}
- * @example
- * // Example
- * var myTransition = cc.TransitionFadeBL.create(1.5, nextScene)
- */
- cc.TransitionFadeBL.create = function (t, scene) {
- return new cc.TransitionFadeBL(t, scene);
- };
- /**
- * Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
- * @class
- * @extends cc.TransitionFadeTR
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionFadeUp(time,scene);
- */
- cc.TransitionFadeUp = cc.TransitionFadeTR.extend(/** @lends cc.TransitionFadeUp# */{
- /**
- * Constructor of TransitionFadeUp
- * @function
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionFadeTR.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- /**
- * @param {cc.Size} size
- * @return {cc.FadeOutUpTiles}
- */
- actionWithSize:function (size) {
- return new cc.FadeOutUpTiles(this._duration, size);
- }
- });
- /**
- * Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.
- * @deprecated since v3.0,please use new cc.TransitionFadeUp(t, scene) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionFadeUp}
- * @example
- * var myTransition = cc.TransitionFadeUp.create(1.5, nextScene)
- */
- cc.TransitionFadeUp.create = function (t, scene) {
- return new cc.TransitionFadeUp(t, scene);
- };
- /**
- * Fade the tiles of the outgoing scene from the top to the bottom.
- * @class
- * @extends cc.TransitionFadeTR
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @example
- * var trans = new cc.TransitionFadeDown(time,scene);
- */
- cc.TransitionFadeDown = cc.TransitionFadeTR.extend(/** @lends cc.TransitionFadeDown# */{
- /**
- * Constructor of TransitionFadeDown
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- */
- ctor:function (t, scene) {
- cc.TransitionFadeTR.prototype.ctor.call(this);
- scene && this.initWithDuration(t, scene);
- },
- /**
- * @param {cc.Size} size
- * @return {*}
- */
- actionWithSize:function (size) {
- return cc.fadeOutDownTiles( this._duration, size);
- }
- });
- /**
- * Fade the tiles of the outgoing scene from the top to the bottom.
- * @deprecated since v3.0,please use new cc.TransitionFadeDown(t, scene) instead.
- * @param {Number} t time in seconds
- * @param {cc.Scene} scene
- * @return {cc.TransitionFadeDown}
- * @example
- * var myTransition = cc.TransitionFadeDown.create(1.5, nextScene)
- */
- cc.TransitionFadeDown.create = function (t, scene) {
- return new cc.TransitionFadeDown(t, scene);
- };
|