1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682 |
- /****************************************************************************
- 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.
- ****************************************************************************/
- /**
- * Base class for Easing actions
- * @class
- * @extends cc.ActionInterval
- * @param {cc.ActionInterval} action
- *
- * @deprecated since v3.0 Does not recommend the use of the base object.
- *
- * @example
- * var moveEase = new cc.ActionEase(action);
- */
- cc.ActionEase = cc.ActionInterval.extend(/** @lends cc.ActionEase# */{
- _inner:null,
- /**
- * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
- * creates the action of ActionEase.
- * @param {cc.ActionInterval} action
- */
- ctor: function (action) {
- cc.ActionInterval.prototype.ctor.call(this);
- action && this.initWithAction(action);
- },
- /**
- * initializes the action
- *
- * @param {cc.ActionInterval} action
- * @return {Boolean}
- */
- initWithAction:function (action) {
- if(!action)
- throw "cc.ActionEase.initWithAction(): action must be non nil";
- if (this.initWithDuration(action.getDuration())) {
- this._inner = action;
- return true;
- }
- return false;
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.ActionEase}
- */
- clone:function(){
- var action = new cc.ActionEase();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * called before the action start. It will also set the target.
- *
- * @param {cc.Node} target
- */
- startWithTarget:function (target) {
- cc.ActionInterval.prototype.startWithTarget.call(this, target);
- this._inner.startWithTarget(this.target);
- },
- /**
- * Stop the action.
- */
- stop:function () {
- this._inner.stop();
- cc.ActionInterval.prototype.stop.call(this);
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- this._inner.update(dt);
- },
- /**
- * Create new action to original operation effect opposite. <br />
- * For example: <br />
- * - The action will be x coordinates of 0 move to 100. <br />
- * - The reversed action will be x of 100 move to 0.
- * - Will be rewritten
- * @return {cc.ActionEase}
- */
- reverse:function () {
- return new cc.ActionEase(this._inner.reverse());
- },
- /**
- * Get inner Action.
- *
- * @return {cc.ActionInterval}
- */
- getInnerAction:function(){
- return this._inner;
- }
- });
- /**
- * creates the action of ActionEase
- *
- * @param {cc.ActionInterval} action
- * @return {cc.ActionEase}
- * @example
- * // example
- * var moveEase = cc.actionEase(action);
- */
- cc.actionEase = function (action) {
- return new cc.ActionEase(action);
- };
- /**
- * Please use cc.actionEase instead
- * creates the action of ActionEase
- *
- * @param {cc.ActionInterval} action
- * @return {cc.ActionEase}
- * @static
- * @deprecated since v3.0 please use cc.actionEase(action) instead.
- */
- cc.ActionEase.create = cc.actionEase;
- /**
- * Base class for Easing actions with rate parameters
- *
- * @class
- * @extends cc.ActionEase
- * @param {cc.ActionInterval} action
- * @param {Number} rate
- *
- * @deprecated since v3.0 please cc.easeRateAction(action, 3.0);
- *
- * @example
- * //The old usage
- * cc.EaseRateAction.create(action, 3.0);
- * //The new usage
- * var moveEaseRateAction = cc.easeRateAction(action, 3.0);
- */
- cc.EaseRateAction = cc.ActionEase.extend(/** @lends cc.EaseRateAction# */{
- _rate:0,
- /**
- * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
- * Creates the action with the inner action and the rate parameter.
- * @param {cc.ActionInterval} action
- * @param {Number} rate
- */
- ctor: function(action, rate){
- cc.ActionEase.prototype.ctor.call(this);
- rate !== undefined && this.initWithAction(action, rate);
- },
- /**
- * set rate value for the actions
- * @param {Number} rate
- */
- setRate:function (rate) {
- this._rate = rate;
- },
- /** get rate value for the actions
- * @return {Number}
- */
- getRate:function () {
- return this._rate;
- },
- /**
- * Initializes the action with the inner action and the rate parameter
- * @param {cc.ActionInterval} action
- * @param {Number} rate
- * @return {Boolean}
- */
- initWithAction:function (action, rate) {
- if (cc.ActionEase.prototype.initWithAction.call(this, action)) {
- this._rate = rate;
- return true;
- }
- return false;
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseRateAction}
- */
- clone:function(){
- var action = new cc.EaseRateAction();
- action.initWithAction(this._inner.clone(), this._rate);
- return action;
- },
- /**
- * Create new action to original operation effect opposite. <br />
- * For example: <br />
- * - The action will be x coordinates of 0 move to 100. <br />
- * - The reversed action will be x of 100 move to 0.
- * - Will be rewritten
- * @return {cc.EaseRateAction}
- */
- reverse:function () {
- return new cc.EaseRateAction(this._inner.reverse(), 1 / this._rate);
- }
- });
- /**
- * Creates the action with the inner action and the rate parameter.
- *
- * @param {cc.ActionInterval} action
- * @param {Number} rate
- * @return {cc.EaseRateAction}
- * @example
- * // example
- * var moveEaseRateAction = cc.easeRateAction(action, 3.0);
- */
- cc.easeRateAction = function (action, rate) {
- return new cc.EaseRateAction(action, rate);
- };
- /**
- * Please use cc.easeRateAction instead. <br />
- * Creates the action with the inner action and the rate parameter.
- *
- * @param {cc.ActionInterval} action
- * @param {Number} rate
- * @return {cc.EaseRateAction}
- * @static
- * @deprecated since v3.0 please use cc.easeRateAction(action, rate)
- * @example
- * //The old usage
- * cc.EaseRateAction.create(action, 3.0);
- * //The new usage
- * var moveEaseRateAction = cc.easeRateAction(action, 3.0);
- */
- cc.EaseRateAction.create = cc.easeRateAction;
- /**
- * cc.EaseIn action with a rate. From slow to fast.
- *
- * @class
- * @extends cc.EaseRateAction
- *
- * @deprecated since v3.0 please use action.easing(cc.easeIn(3));
- *
- * @example
- * //The old usage
- * cc.EaseIn.create(action, 3);
- * //The new usage
- * action.easing(cc.easeIn(3.0));
- */
- cc.EaseIn = cc.EaseRateAction.extend(/** @lends cc.EaseIn# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- this._inner.update(Math.pow(dt, this._rate));
- },
- /**
- * Create a cc.easeIn action. Opposite with the original motion trajectory.
- * @return {cc.EaseIn}
- */
- reverse:function () {
- return new cc.EaseIn(this._inner.reverse(), 1 / this._rate);
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseIn}
- */
- clone:function(){
- var action = new cc.EaseIn();
- action.initWithAction(this._inner.clone(), this._rate);
- return action;
- }
- });
- /**
- * Creates the action with the inner action and the rate parameter. <br />
- * From slow to fast.
- *
- * @static
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeIn(3))
- *
- * @example
- * //The old usage
- * cc.EaseIn.create(action, 3);
- * //The new usage
- * action.easing(cc.easeIn(3.0));
- *
- * @param {cc.ActionInterval} action
- * @param {Number} rate
- * @return {cc.EaseIn}
- */
- cc.EaseIn.create = function (action, rate) {
- return new cc.EaseIn(action, rate);
- };
- /**
- * Creates the action easing object with the rate parameter. <br />
- * From slow to fast.
- *
- * @function
- * @param {Number} rate
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeIn(3.0));
- */
- cc.easeIn = function (rate) {
- return {
- _rate: rate,
- easing: function (dt) {
- return Math.pow(dt, this._rate);
- },
- reverse: function(){
- return cc.easeIn(1 / this._rate);
- }
- };
- };
- /**
- * cc.EaseOut action with a rate. From fast to slow.
- *
- * @class
- * @extends cc.EaseRateAction
- *
- * @deprecated since v3.0 please use action.easing(cc.easeOut(3))
- *
- * @example
- * //The old usage
- * cc.EaseOut.create(action, 3);
- * //The new usage
- * action.easing(cc.easeOut(3.0));
- */
- cc.EaseOut = cc.EaseRateAction.extend(/** @lends cc.EaseOut# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- this._inner.update(Math.pow(dt, 1 / this._rate));
- },
- /**
- * Create a cc.easeIn action. Opposite with the original motion trajectory.
- * @return {cc.EaseOut}
- */
- reverse:function () {
- return new cc.EaseOut(this._inner.reverse(), 1 / this._rate);
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseOut}
- */
- clone:function(){
- var action = new cc.EaseOut();
- action.initWithAction(this._inner.clone(),this._rate);
- return action;
- }
- });
- /**
- * Creates the action with the inner action and the rate parameter. <br />
- * From fast to slow.
- *
- * @static
- * @deprecated since v3.0 <br /> Please use cc.easeOut instead.
- *
- * @example
- * //The old usage
- * cc.EaseOut.create(action, 3);
- * //The new usage
- * action.easing(cc.easeOut(3.0));
- *
- * @param {cc.ActionInterval} action
- * @param {Number} rate
- * @return {cc.EaseOut}
- */
- cc.EaseOut.create = function (action, rate) {
- return new cc.EaseOut(action, rate);
- };
- /**
- * Creates the action easing object with the rate parameter. <br />
- * From fast to slow.
- *
- * @function
- * @param {Number} rate
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeOut(3.0));
- */
- cc.easeOut = function (rate) {
- return {
- _rate: rate,
- easing: function (dt) {
- return Math.pow(dt, 1 / this._rate);
- },
- reverse: function(){
- return cc.easeOut(1 / this._rate)
- }
- };
- };
- /**
- * cc.EaseInOut action with a rate. <br />
- * Slow to fast then to slow.
- * @class
- * @extends cc.EaseRateAction
- *
- * @deprecated since v3.0 please use action.easing(cc.easeInOut(3.0))
- *
- * @example
- * //The old usage
- * cc.EaseInOut.create(action, 3);
- * //The new usage
- * action.easing(cc.easeInOut(3.0));
- */
- cc.EaseInOut = cc.EaseRateAction.extend(/** @lends cc.EaseInOut# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- dt *= 2;
- if (dt < 1)
- this._inner.update(0.5 * Math.pow(dt, this._rate));
- else
- this._inner.update(1.0 - 0.5 * Math.pow(2 - dt, this._rate));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseInOut}
- */
- clone:function(){
- var action = new cc.EaseInOut();
- action.initWithAction(this._inner.clone(), this._rate);
- return action;
- },
- /**
- * Create a cc.EaseInOut action. Opposite with the original motion trajectory.
- * @return {cc.EaseInOut}
- */
- reverse:function () {
- return new cc.EaseInOut(this._inner.reverse(), this._rate);
- }
- });
- /**
- * Creates the action with the inner action and the rate parameter.
- * Slow to fast then to slow.
- * @static
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeInOut(3.0))
- *
- * @example
- * //The old usage
- * cc.EaseInOut.create(action, 3);
- * //The new usage
- * action.easing(cc.easeInOut(3.0));
- *
- * @param {cc.ActionInterval} action
- * @param {Number} rate
- * @return {cc.EaseInOut}
- */
- cc.EaseInOut.create = function (action, rate) {
- return new cc.EaseInOut(action, rate);
- };
- /**
- * Creates the action easing object with the rate parameter. <br />
- * Slow to fast then to slow.
- * @function
- * @param {Number} rate
- * @return {Object}
- *
- * @example
- * //The new usage
- * action.easing(cc.easeInOut(3.0));
- */
- cc.easeInOut = function (rate) {
- return {
- _rate: rate,
- easing: function (dt) {
- dt *= 2;
- if (dt < 1)
- return 0.5 * Math.pow(dt, this._rate);
- else
- return 1.0 - 0.5 * Math.pow(2 - dt, this._rate);
- },
- reverse: function(){
- return cc.easeInOut(this._rate);
- }
- };
- };
- /**
- * cc.Ease Exponential In. Slow to Fast. <br />
- * Reference easeInExpo: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 please action.easing(cc.easeExponentialIn())
- *
- * @example
- * //The old usage
- * cc.EaseExponentialIn.create(action);
- * //The new usage
- * action.easing(cc.easeExponentialIn());
- */
- cc.EaseExponentialIn = cc.ActionEase.extend(/** @lends cc.EaseExponentialIn# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- this._inner.update(dt === 0 ? 0 : Math.pow(2, 10 * (dt - 1)));
- },
- /**
- * Create a cc.EaseExponentialOut action. Opposite with the original motion trajectory.
- * @return {cc.EaseExponentialOut}
- */
- reverse:function () {
- return new cc.EaseExponentialOut(this._inner.reverse());
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseExponentialIn}
- */
- clone:function(){
- var action = new cc.EaseExponentialIn();
- action.initWithAction(this._inner.clone());
- return action;
- }
- });
- /**
- * Creates the action easing object with the rate parameter. <br />
- * Reference easeInExpo: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeExponentialIn())
- * @param {cc.ActionInterval} action
- * @return {cc.EaseExponentialIn}
- *
- * @example
- * //The old usage
- * cc.EaseExponentialIn.create(action);
- * //The new usage
- * action.easing(cc.easeExponentialIn());
- */
- cc.EaseExponentialIn.create = function (action) {
- return new cc.EaseExponentialIn(action);
- };
- cc._easeExponentialInObj = {
- easing: function(dt){
- return dt === 0 ? 0 : Math.pow(2, 10 * (dt - 1));
- },
- reverse: function(){
- return cc._easeExponentialOutObj;
- }
- };
- /**
- * Creates the action easing object with the rate parameter. <br />
- * Reference easeInExpo: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeExponentialIn());
- */
- cc.easeExponentialIn = function(){
- return cc._easeExponentialInObj;
- };
- /**
- * Ease Exponential Out. <br />
- * Reference easeOutExpo: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 please use action.easing(cc.easeExponentialOut())
- *
- * @example
- * //The old usage
- * cc.EaseExponentialOut.create(action);
- * //The new usage
- * action.easing(cc.easeExponentialOut());
- */
- cc.EaseExponentialOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialOut# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- this._inner.update(dt == 1 ? 1 : (-(Math.pow(2, -10 * dt)) + 1));
- },
- /**
- * Create a cc.EaseExponentialIn action. Opposite with the original motion trajectory.
- * @return {cc.EaseExponentialIn}
- */
- reverse:function () {
- return new cc.EaseExponentialIn(this._inner.reverse());
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseExponentialOut}
- */
- clone:function(){
- var action = new cc.EaseExponentialOut();
- action.initWithAction(this._inner.clone());
- return action;
- }
- });
- /**
- * Creates the action easing object with the rate parameter. <br />
- * Reference easeOutExpo: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeExponentialOut())
- * @param {cc.ActionInterval} action
- * @return {Object}
- *
- * @example
- * //The old usage
- * cc.EaseExponentialOut.create(action);
- * //The new usage
- * action.easing(cc.easeExponentialOut());
- */
- cc.EaseExponentialOut.create = function (action) {
- return new cc.EaseExponentialOut(action);
- };
- cc._easeExponentialOutObj = {
- easing: function(dt){
- return dt == 1 ? 1 : (-(Math.pow(2, -10 * dt)) + 1);
- },
- reverse: function(){
- return cc._easeExponentialInObj;
- }
- };
- /**
- * creates the action easing object. <br />
- * Reference easeOutExpo: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- *
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeExponentialOut());
- */
- cc.easeExponentialOut = function(){
- return cc._easeExponentialOutObj;
- };
- /**
- * Ease Exponential InOut. <br />
- * Reference easeInOutExpo: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- *
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 please use action.easing(cc.easeExponentialInOut)
- *
- * @example
- * //The old usage
- * cc.EaseExponentialInOut.create(action);
- * //The new usage
- * action.easing(cc.easeExponentialInOut());
- */
- cc.EaseExponentialInOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialInOut# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- if( dt != 1 && dt !== 0) {
- dt *= 2;
- if (dt < 1)
- dt = 0.5 * Math.pow(2, 10 * (dt - 1));
- else
- dt = 0.5 * (-Math.pow(2, -10 * (dt - 1)) + 2);
- }
- this._inner.update(dt);
- },
- /**
- * Create a cc.EaseExponentialInOut action. Opposite with the original motion trajectory.
- * @return {cc.EaseExponentialInOut}
- */
- reverse:function () {
- return new cc.EaseExponentialInOut(this._inner.reverse());
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseExponentialInOut}
- */
- clone:function(){
- var action = new cc.EaseExponentialInOut();
- action.initWithAction(this._inner.clone());
- return action;
- }
- });
- /**
- * creates an EaseExponentialInOut action. <br />
- * Reference easeInOutExpo: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeExponentialInOut)
- * @param {cc.ActionInterval} action
- * @return {cc.EaseExponentialInOut}
- *
- * @example
- * //The old usage
- * cc.EaseExponentialInOut.create(action);
- * //The new usage
- * action.easing(cc.easeExponentialInOut());
- */
- cc.EaseExponentialInOut.create = function (action) {
- return new cc.EaseExponentialInOut(action);
- };
- cc._easeExponentialInOutObj = {
- easing: function(dt){
- if( dt !== 1 && dt !== 0) {
- dt *= 2;
- if (dt < 1)
- return 0.5 * Math.pow(2, 10 * (dt - 1));
- else
- return 0.5 * (-Math.pow(2, -10 * (dt - 1)) + 2);
- }
- return dt;
- },
- reverse: function(){
- return cc._easeExponentialInOutObj;
- }
- };
- /**
- * creates an EaseExponentialInOut action easing object. <br />
- * Reference easeInOutExpo: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeExponentialInOut());
- */
- cc.easeExponentialInOut = function(){
- return cc._easeExponentialInOutObj;
- };
- /**
- * Ease Sine In. <br />
- * Reference easeInSine: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 please use action.easing(cc.easeSineIn())
- *
- * @example
- * //The old usage
- * cc.EaseSineIn.create(action);
- * //The new usage
- * action.easing(cc.easeSineIn());
- */
- cc.EaseSineIn = cc.ActionEase.extend(/** @lends cc.EaseSineIn# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- dt = dt===0 || dt===1 ? dt : -1 * Math.cos(dt * Math.PI / 2) + 1;
- this._inner.update(dt);
- },
- /**
- * Create a cc.EaseSineOut action. Opposite with the original motion trajectory.
- * @return {cc.EaseSineOut}
- */
- reverse:function () {
- return new cc.EaseSineOut(this._inner.reverse());
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseSineIn}
- */
- clone:function(){
- var action = new cc.EaseSineIn();
- action.initWithAction(this._inner.clone());
- return action;
- }
- });
- /**
- * creates an EaseSineIn action. <br />
- * Reference easeInSine: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeSineIn())
- * @param {cc.ActionInterval} action
- * @return {cc.EaseSineIn}
- *
- * @example
- * //The old usage
- * cc.EaseSineIn.create(action);
- * //The new usage
- * action.easing(cc.easeSineIn());
- */
- cc.EaseSineIn.create = function (action) {
- return new cc.EaseSineIn(action);
- };
- cc._easeSineInObj = {
- easing: function(dt){
- return (dt===0 || dt===1) ? dt : -1 * Math.cos(dt * Math.PI / 2) + 1;
- },
- reverse: function(){
- return cc._easeSineOutObj;
- }
- };
- /**
- * creates an EaseSineIn action. <br />
- * Reference easeInSine: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeSineIn());
- */
- cc.easeSineIn = function(){
- return cc._easeSineInObj;
- };
- /**
- * Ease Sine Out. <br />
- * Reference easeOutSine: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 please use action.easing(cc.easeSineOut())
- *
- * @example
- * //The old usage
- * cc.EaseSineOut.create(action);
- * //The new usage
- * action.easing(cc.easeSineOut());
- */
- cc.EaseSineOut = cc.ActionEase.extend(/** @lends cc.EaseSineOut# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- dt = dt===0 || dt===1 ? dt : Math.sin(dt * Math.PI / 2);
- this._inner.update(dt);
- },
- /**
- * Create a cc.EaseSineIn action. Opposite with the original motion trajectory.
- * @return {cc.EaseSineIn}
- */
- reverse:function () {
- return new cc.EaseSineIn(this._inner.reverse());
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseSineOut}
- */
- clone:function(){
- var action = new cc.EaseSineOut();
- action.initWithAction(this._inner.clone());
- return action;
- }
- });
- /**
- * Creates an EaseSineOut action. <br />
- * Reference easeOutSine: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeSineOut())
- * @param {cc.ActionInterval} action
- * @return {cc.EaseSineOut}
- *
- * @example
- * //The old usage
- * cc.EaseSineOut.create(action);
- * //The new usage
- * action.easing(cc.easeSineOut());
- */
- cc.EaseSineOut.create = function (action) {
- return new cc.EaseSineOut(action);
- };
- cc._easeSineOutObj = {
- easing: function(dt){
- return (dt===0 || dt==1) ? dt : Math.sin(dt * Math.PI / 2);
- },
- reverse: function(){
- return cc._easeSineInObj;
- }
- };
- /**
- * Creates an EaseSineOut action easing object. <br />
- * Reference easeOutSine: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeSineOut());
- */
- cc.easeSineOut = function(){
- return cc._easeSineOutObj;
- };
- /**
- * Ease Sine InOut. <br />
- * Reference easeInOutSine: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 please use action.easing(cc.easeSineInOut())
- *
- * @example
- * //The old usage
- * cc.EaseSineInOut.create(action);
- * //The new usage
- * action.easing(cc.easeSineInOut());
- */
- cc.EaseSineInOut = cc.ActionEase.extend(/** @lends cc.EaseSineInOut# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- dt = dt===0 || dt===1 ? dt : -0.5 * (Math.cos(Math.PI * dt) - 1);
- this._inner.update(dt);
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseSineInOut}
- */
- clone:function(){
- var action = new cc.EaseSineInOut();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a cc.EaseSineInOut action. Opposite with the original motion trajectory.
- * @return {cc.EaseSineInOut}
- */
- reverse:function () {
- return new cc.EaseSineInOut(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeInOutSine: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- * @param {cc.ActionInterval} action
- * @return {cc.EaseSineInOut}
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeSineInOut())
- *
- * @example
- * //The old usage
- * cc.EaseSineInOut.create(action);
- * //The new usage
- * action.easing(cc.easeSineInOut());
- */
- cc.EaseSineInOut.create = function (action) {
- return new cc.EaseSineInOut(action);
- };
- cc._easeSineInOutObj = {
- easing: function(dt){
- return (dt === 0 || dt === 1) ? dt : -0.5 * (Math.cos(Math.PI * dt) - 1);
- },
- reverse: function(){
- return cc._easeSineInOutObj;
- }
- };
- /**
- * creates the action easing object. <br />
- * Reference easeInOutSine: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeSineInOut());
- */
- cc.easeSineInOut = function(){
- return cc._easeSineInOutObj;
- };
- /**
- * Ease Elastic abstract class.
- * @class
- * @extends cc.ActionEase
- * @param {cc.ActionInterval} action
- * @param {Number} [period=0.3]
- *
- * @deprecated since v3.0 Does not recommend the use of the base object.
- */
- cc.EaseElastic = cc.ActionEase.extend(/** @lends cc.EaseElastic# */{
- _period: 0.3,
- /**
- * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
- * Creates the action with the inner action and the period in radians (default is 0.3).
- * @param {cc.ActionInterval} action
- * @param {Number} [period=0.3]
- */
- ctor:function(action, period){
- cc.ActionEase.prototype.ctor.call(this);
- action && this.initWithAction(action, period);
- },
- /**
- * get period of the wave in radians. default is 0.3
- * @return {Number}
- */
- getPeriod:function () {
- return this._period;
- },
- /**
- * set period of the wave in radians.
- * @param {Number} period
- */
- setPeriod:function (period) {
- this._period = period;
- },
- /**
- * Initializes the action with the inner action and the period in radians (default is 0.3)
- * @param {cc.ActionInterval} action
- * @param {Number} [period=0.3]
- * @return {Boolean}
- */
- initWithAction:function (action, period) {
- cc.ActionEase.prototype.initWithAction.call(this, action);
- this._period = (period == null) ? 0.3 : period;
- return true;
- },
- /**
- * Create a action. Opposite with the original motion trajectory. <br />
- * Will be overwrite.
- * @return {null}
- */
- reverse:function () {
- cc.log("cc.EaseElastic.reverse(): it should be overridden in subclass.");
- return null;
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseElastic}
- */
- clone:function(){
- var action = new cc.EaseElastic();
- action.initWithAction(this._inner.clone(), this._period);
- return action;
- }
- });
- /**
- * Creates the action with the inner action and the period in radians (default is 0.3).
- * @static
- * @deprecated since v3.0 Does not recommend the use of the base object.
- * @param {cc.ActionInterval} action
- * @param {Number} [period=0.3]
- * @return {cc.EaseElastic}
- */
- cc.EaseElastic.create = function (action, period) {
- return new cc.EaseElastic(action, period);
- };
- /**
- * Ease Elastic In action. <br />
- * Reference easeInElastic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
- * @class
- * @extends cc.EaseElastic
- *
- * @deprecated since v3.0 please use action.easing(cc.easeElasticIn())
- *
- * @example
- * //The old usage
- * cc.EaseElasticIn.create(action, period);
- * //The new usage
- * action.easing(cc.easeElasticIn(period));
- */
- cc.EaseElasticIn = cc.EaseElastic.extend(/** @lends cc.EaseElasticIn# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- var newT = 0;
- if (dt === 0 || dt === 1) {
- newT = dt;
- } else {
- var s = this._period / 4;
- dt = dt - 1;
- newT = -Math.pow(2, 10 * dt) * Math.sin((dt - s) * Math.PI * 2 / this._period);
- }
- this._inner.update(newT);
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseElasticOut}
- */
- reverse:function () {
- return new cc.EaseElasticOut(this._inner.reverse(), this._period);
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseElasticIn}
- */
- clone:function(){
- var action = new cc.EaseElasticIn();
- action.initWithAction(this._inner.clone(), this._period);
- return action;
- }
- });
- /**
- * Creates the action with the inner action and the period in radians (default is 0.3). <br />
- * Reference easeInElastic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeElasticIn(period))
- *
- * @example
- * //The old usage
- * cc.EaseElasticIn.create(action, period);
- * //The new usage
- * action.easing(cc.easeElasticIn(period));
- *
- * @param {cc.ActionInterval} action
- * @param {Number} [period=0.3]
- * @return {cc.EaseElasticIn}
- */
- cc.EaseElasticIn.create = function (action, period) {
- return new cc.EaseElasticIn(action, period);
- };
- //default ease elastic in object (period = 0.3)
- cc._easeElasticInObj = {
- easing:function(dt){
- if (dt === 0 || dt === 1)
- return dt;
- dt = dt - 1;
- return -Math.pow(2, 10 * dt) * Math.sin((dt - (0.3 / 4)) * Math.PI * 2 / 0.3);
- },
- reverse:function(){
- return cc._easeElasticOutObj;
- }
- };
- /**
- * Creates the action easing obejct with the period in radians (default is 0.3). <br />
- * Reference easeInElastic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @param {Number} [period=0.3]
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeElasticIn(3.0));
- */
- cc.easeElasticIn = function (period) {
- if(period && period !== 0.3){
- return {
- _period: period,
- easing: function (dt) {
- if (dt === 0 || dt === 1)
- return dt;
- dt = dt - 1;
- return -Math.pow(2, 10 * dt) * Math.sin((dt - (this._period / 4)) * Math.PI * 2 / this._period);
- },
- reverse:function () {
- return cc.easeElasticOut(this._period);
- }
- };
- }
- return cc._easeElasticInObj;
- };
- /**
- * Ease Elastic Out action. <br />
- * Reference easeOutElastic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
- * @class
- * @extends cc.EaseElastic
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeElasticOut(period))
- *
- * @example
- * //The old usage
- * cc.EaseElasticOut.create(action, period);
- * //The new usage
- * action.easing(cc.easeElasticOut(period));
- */
- cc.EaseElasticOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticOut# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- var newT = 0;
- if (dt === 0 || dt == 1) {
- newT = dt;
- } else {
- var s = this._period / 4;
- newT = Math.pow(2, -10 * dt) * Math.sin((dt - s) * Math.PI * 2 / this._period) + 1;
- }
- this._inner.update(newT);
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseElasticIn}
- */
- reverse:function () {
- return new cc.EaseElasticIn(this._inner.reverse(), this._period);
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseElasticOut}
- */
- clone:function(){
- var action = new cc.EaseElasticOut();
- action.initWithAction(this._inner.clone(), this._period);
- return action;
- }
- });
- /**
- * Creates the action with the inner action and the period in radians (default is 0.3). <br />
- * Reference easeOutElastic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeElasticOut(period))
- * @param {cc.ActionInterval} action
- * @param {Number} [period=0.3]
- * @return {cc.EaseElasticOut}
- *
- * @example
- * //The old usage
- * cc.EaseElasticOut.create(action, period);
- * //The new usage
- * action.easing(cc.easeElasticOut(period));
- */
- cc.EaseElasticOut.create = function (action, period) {
- return new cc.EaseElasticOut(action, period);
- };
- //default ease elastic out object (period = 0.3)
- cc._easeElasticOutObj = {
- easing: function (dt) {
- return (dt === 0 || dt === 1) ? dt : Math.pow(2, -10 * dt) * Math.sin((dt - (0.3 / 4)) * Math.PI * 2 / 0.3) + 1;
- },
- reverse:function(){
- return cc._easeElasticInObj;
- }
- };
- /**
- * Creates the action easing object with the period in radians (default is 0.3). <br />
- * Reference easeOutElastic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @param {Number} [period=0.3]
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeElasticOut(3.0));
- */
- cc.easeElasticOut = function (period) {
- if(period && period !== 0.3){
- return {
- _period: period,
- easing: function (dt) {
- return (dt === 0 || dt === 1) ? dt : Math.pow(2, -10 * dt) * Math.sin((dt - (this._period / 4)) * Math.PI * 2 / this._period) + 1;
- },
- reverse:function(){
- return cc.easeElasticIn(this._period);
- }
- };
- }
- return cc._easeElasticOutObj;
- };
- /**
- * Ease Elastic InOut action. <br />
- * Reference easeInOutElastic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
- * @class
- * @extends cc.EaseElastic
- *
- * @deprecated since v3.0 please use action.easing(cc.easeElasticInOut())
- *
- * @example
- * //The old usage
- * cc.EaseElasticInOut.create(action, period);
- * //The new usage
- * action.easing(cc.easeElasticInOut(period));
- */
- cc.EaseElasticInOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticInOut# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- var newT = 0;
- var locPeriod = this._period;
- if (dt === 0 || dt == 1) {
- newT = dt;
- } else {
- dt = dt * 2;
- if (!locPeriod)
- locPeriod = this._period = 0.3 * 1.5;
- var s = locPeriod / 4;
- dt = dt - 1;
- if (dt < 0)
- newT = -0.5 * Math.pow(2, 10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod);
- else
- newT = Math.pow(2, -10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod) * 0.5 + 1;
- }
- this._inner.update(newT);
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseElasticInOut}
- */
- reverse:function () {
- return new cc.EaseElasticInOut(this._inner.reverse(), this._period);
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseElasticInOut}
- */
- clone:function(){
- var action = new cc.EaseElasticInOut();
- action.initWithAction(this._inner.clone(), this._period);
- return action;
- }
- });
- /**
- * Creates the action with the inner action and the period in radians (default is 0.3). <br />
- * Reference easeInOutElastic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeElasticInOut(period))
- * @param {cc.ActionInterval} action
- * @param {Number} [period=0.3]
- * @return {cc.EaseElasticInOut}
- *
- * @example
- * //The old usage
- * cc.EaseElasticInOut.create(action, period);
- * //The new usage
- * action.easing(cc.easeElasticInOut(period));
- */
- cc.EaseElasticInOut.create = function (action, period) {
- return new cc.EaseElasticInOut(action, period);
- };
- /**
- * Creates the action easing object with the period in radians (default is 0.3). <br />
- * Reference easeInOutElastic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @param {Number} [period=0.3]
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeElasticInOut(3.0));
- */
- cc.easeElasticInOut = function (period) {
- period = period || 0.3;
- return {
- _period: period,
- easing: function (dt) {
- var newT = 0;
- var locPeriod = this._period;
- if (dt === 0 || dt === 1) {
- newT = dt;
- } else {
- dt = dt * 2;
- if (!locPeriod)
- locPeriod = this._period = 0.3 * 1.5;
- var s = locPeriod / 4;
- dt = dt - 1;
- if (dt < 0)
- newT = -0.5 * Math.pow(2, 10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod);
- else
- newT = Math.pow(2, -10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod) * 0.5 + 1;
- }
- return newT;
- },
- reverse: function(){
- return cc.easeElasticInOut(this._period);
- }
- };
- };
- /**
- * cc.EaseBounce abstract class.
- *
- * @deprecated since v3.0 Does not recommend the use of the base object.
- *
- * @class
- * @extends cc.ActionEase
- */
- cc.EaseBounce = cc.ActionEase.extend(/** @lends cc.EaseBounce# */{
- /**
- * @param {Number} time1
- * @return {Number}
- */
- bounceTime:function (time1) {
- if (time1 < 1 / 2.75) {
- return 7.5625 * time1 * time1;
- } else if (time1 < 2 / 2.75) {
- time1 -= 1.5 / 2.75;
- return 7.5625 * time1 * time1 + 0.75;
- } else if (time1 < 2.5 / 2.75) {
- time1 -= 2.25 / 2.75;
- return 7.5625 * time1 * time1 + 0.9375;
- }
- time1 -= 2.625 / 2.75;
- return 7.5625 * time1 * time1 + 0.984375;
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseBounce}
- */
- clone:function(){
- var action = new cc.EaseBounce();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseBounce}
- */
- reverse:function () {
- return new cc.EaseBounce(this._inner.reverse());
- }
- });
- /**
- * Creates an ease bounce action.
- * @static
- * @deprecated since v3.0 Does not recommend the use of the base object.
- * @param {cc.ActionInterval} action
- * @return {cc.EaseBounce}
- */
- cc.EaseBounce.create = function (action) {
- return new cc.EaseBounce(action);
- };
- /**
- * cc.EaseBounceIn action. <br />
- * Eased bounce effect at the beginning.
- * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
- * @class
- * @extends cc.EaseBounce
- *
- * @deprecated since v3.0 please use action.easing(cc.easeBounceIn())
- *
- * @example
- * //The old usage
- * cc.EaseBounceIn.create(action);
- * //The new usage
- * action.easing(cc.easeBounceIn());
- */
- cc.EaseBounceIn = cc.EaseBounce.extend(/** @lends cc.EaseBounceIn# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- var newT = 1 - this.bounceTime(1 - dt);
- this._inner.update(newT);
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseBounceOut}
- */
- reverse:function () {
- return new cc.EaseBounceOut(this._inner.reverse());
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseBounceIn}
- */
- clone:function(){
- var action = new cc.EaseBounceIn();
- action.initWithAction(this._inner.clone());
- return action;
- }
- });
- /**
- * Creates the action. <br />
- * Eased bounce effect at the beginning.
- * @static
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeBounceIn())
- * @param {cc.ActionInterval} action
- * @return {cc.EaseBounceIn}
- *
- * @example
- * //The old usage
- * cc.EaseBounceIn.create(action);
- * //The new usage
- * action.easing(cc.easeBounceIn());
- */
- cc.EaseBounceIn.create = function (action) {
- return new cc.EaseBounceIn(action);
- };
- cc._bounceTime = function (time1) {
- if (time1 < 1 / 2.75) {
- return 7.5625 * time1 * time1;
- } else if (time1 < 2 / 2.75) {
- time1 -= 1.5 / 2.75;
- return 7.5625 * time1 * time1 + 0.75;
- } else if (time1 < 2.5 / 2.75) {
- time1 -= 2.25 / 2.75;
- return 7.5625 * time1 * time1 + 0.9375;
- }
- time1 -= 2.625 / 2.75;
- return 7.5625 * time1 * time1 + 0.984375;
- };
- cc._easeBounceInObj = {
- easing: function(dt){
- return 1 - cc._bounceTime(1 - dt);
- },
- reverse: function(){
- return cc._easeBounceOutObj;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Eased bounce effect at the beginning.
- * @function
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeBounceIn());
- */
- cc.easeBounceIn = function(){
- return cc._easeBounceInObj;
- };
- /**
- * cc.EaseBounceOut action. <br />
- * Eased bounce effect at the ending.
- * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
- * @class
- * @extends cc.EaseBounce
- *
- * @deprecated since v3.0 please use action.easing(cc.easeBounceOut())
- *
- * @example
- * //The old usage
- * cc.EaseBounceOut.create(action);
- * //The new usage
- * action.easing(cc.easeBounceOut());
- */
- cc.EaseBounceOut = cc.EaseBounce.extend(/** @lends cc.EaseBounceOut# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- var newT = this.bounceTime(dt);
- this._inner.update(newT);
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseBounceIn}
- */
- reverse:function () {
- return new cc.EaseBounceIn(this._inner.reverse());
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseBounceOut}
- */
- clone:function(){
- var action = new cc.EaseBounceOut();
- action.initWithAction(this._inner.clone());
- return action;
- }
- });
- /**
- * Creates the action. <br />
- * Eased bounce effect at the ending.
- * @static
- * @deprecated since v3.0 please use action.easing(cc.easeBounceOut())
- * @param {cc.ActionInterval} action
- * @return {cc.EaseBounceOut}
- *
- * @example
- * //The old usage
- * cc.EaseBounceOut.create(action);
- * //The new usage
- * action.easing(cc.easeBounceOut());
- */
- cc.EaseBounceOut.create = function (action) {
- return new cc.EaseBounceOut(action);
- };
- cc._easeBounceOutObj = {
- easing: function(dt){
- return cc._bounceTime(dt);
- },
- reverse:function () {
- return cc._easeBounceInObj;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Eased bounce effect at the ending.
- * @function
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeBounceOut());
- */
- cc.easeBounceOut = function(){
- return cc._easeBounceOutObj;
- };
- /**
- * cc.EaseBounceInOut action. <br />
- * Eased bounce effect at the begining and ending.
- * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
- * @class
- * @extends cc.EaseBounce
- *
- * @deprecated since v3.0 <br /> Please use acton.easing(cc.easeBounceInOut())
- *
- * @example
- * //The old usage
- * cc.EaseBounceInOut.create(action);
- * //The new usage
- * action.easing(cc.easeBounceInOut());
- */
- cc.EaseBounceInOut = cc.EaseBounce.extend(/** @lends cc.EaseBounceInOut# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- var newT = 0;
- if (dt < 0.5) {
- dt = dt * 2;
- newT = (1 - this.bounceTime(1 - dt)) * 0.5;
- } else {
- newT = this.bounceTime(dt * 2 - 1) * 0.5 + 0.5;
- }
- this._inner.update(newT);
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseBounceInOut}
- */
- clone:function(){
- var action = new cc.EaseBounceInOut();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseBounceInOut}
- */
- reverse:function () {
- return new cc.EaseBounceInOut(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Eased bounce effect at the begining and ending.
- * @static
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeBounceInOut())
- * @param {cc.ActionInterval} action
- * @return {cc.EaseBounceInOut}
- *
- * @example
- * //The old usage
- * cc.EaseBounceInOut.create(action);
- * //The new usage
- * action.easing(cc.easeBounceInOut());
- */
- cc.EaseBounceInOut.create = function (action) {
- return new cc.EaseBounceInOut(action);
- };
- cc._easeBounceInOutObj = {
- easing: function (time1) {
- var newT;
- if (time1 < 0.5) {
- time1 = time1 * 2;
- newT = (1 - cc._bounceTime(1 - time1)) * 0.5;
- } else {
- newT = cc._bounceTime(time1 * 2 - 1) * 0.5 + 0.5;
- }
- return newT;
- },
- reverse: function(){
- return cc._easeBounceInOutObj;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Eased bounce effect at the begining and ending.
- * @function
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeBounceInOut());
- */
- cc.easeBounceInOut = function(){
- return cc._easeBounceInOutObj;
- };
- /**
- * cc.EaseBackIn action. <br />
- * In the opposite direction to move slowly, and then accelerated to the right direction.
- * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 please use action.easing(cc.easeBackIn())
- *
- * @example
- * //The old usage
- * cc.EaseBackIn.create(action);
- * //The new usage
- * action.easing(cc.easeBackIn());
- */
- cc.EaseBackIn = cc.ActionEase.extend(/** @lends cc.EaseBackIn# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- var overshoot = 1.70158;
- dt = dt===0 || dt==1 ? dt : dt * dt * ((overshoot + 1) * dt - overshoot);
- this._inner.update(dt);
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseBackOut}
- */
- reverse:function () {
- return new cc.EaseBackOut(this._inner.reverse());
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseBackIn}
- */
- clone:function(){
- var action = new cc.EaseBackIn();
- action.initWithAction(this._inner.clone());
- return action;
- }
- });
- /**
- * Creates the cc.EaseBackIn. <br />
- * In the opposite direction to move slowly, and then accelerated to the right direction.
- * @static
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeBackIn())
- * @param {cc.ActionInterval} action
- * @return {cc.EaseBackIn}
- *
- * @example
- * //The old usage
- * cc.EaseBackIn.create(action);
- * //The new usage
- * action.easing(cc.easeBackIn());
- */
- cc.EaseBackIn.create = function (action) {
- return new cc.EaseBackIn(action);
- };
- cc._easeBackInObj = {
- easing: function (time1) {
- var overshoot = 1.70158;
- return (time1===0 || time1===1) ? time1 : time1 * time1 * ((overshoot + 1) * time1 - overshoot);
- },
- reverse: function(){
- return cc._easeBackOutObj;
- }
- };
- /**
- * Creates the action easing object. <br />
- * In the opposite direction to move slowly, and then accelerated to the right direction.
- * @function
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeBackIn());
- */
- cc.easeBackIn = function(){
- return cc._easeBackInObj;
- };
- /**
- * cc.EaseBackOut action. <br />
- * Fast moving more than the finish, and then slowly back to the finish.
- * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 please use action.easing(cc.easeBackOut());
- *
- * @example
- * //The old usage
- * cc.EaseBackOut.create(action);
- * //The new usage
- * action.easing(cc.easeBackOut());
- */
- cc.EaseBackOut = cc.ActionEase.extend(/** @lends cc.EaseBackOut# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- var overshoot = 1.70158;
- dt = dt - 1;
- this._inner.update(dt * dt * ((overshoot + 1) * dt + overshoot) + 1);
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseBackIn}
- */
- reverse:function () {
- return new cc.EaseBackIn(this._inner.reverse());
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseBackOut}
- */
- clone:function(){
- var action = new cc.EaseBackOut();
- action.initWithAction(this._inner.clone());
- return action;
- }
- });
- /**
- * Creates the action. <br />
- * Fast moving more than the finish, and then slowly back to the finish.
- * @static
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeBackOut());
- * @param {cc.ActionInterval} action
- * @return {cc.EaseBackOut}
- *
- * @example
- * //The old usage
- * cc.EaseBackOut.create(action);
- * //The new usage
- * action.easing(cc.easeBackOut());
- */
- cc.EaseBackOut.create = function (action) {
- return new cc.EaseBackOut(action);
- };
- cc._easeBackOutObj = {
- easing: function (time1) {
- var overshoot = 1.70158;
- time1 = time1 - 1;
- return time1 * time1 * ((overshoot + 1) * time1 + overshoot) + 1;
- },
- reverse: function(){
- return cc._easeBackInObj;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Fast moving more than the finish, and then slowly back to the finish.
- * @function
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeBackOut());
- */
- cc.easeBackOut = function(){
- return cc._easeBackOutObj;
- };
- /**
- * cc.EaseBackInOut action. <br />
- * Begining of cc.EaseBackIn. Ending of cc.EaseBackOut.
- * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeBackInOut())
- *
- * @example
- * //The old usage
- * cc.EaseBackInOut.create(action);
- * //The new usage
- * action.easing(cc.easeBackInOut());
- */
- cc.EaseBackInOut = cc.ActionEase.extend(/** @lends cc.EaseBackInOut# */{
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update:function (dt) {
- var overshoot = 1.70158 * 1.525;
- dt = dt * 2;
- if (dt < 1) {
- this._inner.update((dt * dt * ((overshoot + 1) * dt - overshoot)) / 2);
- } else {
- dt = dt - 2;
- this._inner.update((dt * dt * ((overshoot + 1) * dt + overshoot)) / 2 + 1);
- }
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseBackInOut}
- */
- clone:function(){
- var action = new cc.EaseBackInOut();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseBackInOut}
- */
- reverse:function () {
- return new cc.EaseBackInOut(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Begining of cc.EaseBackIn. Ending of cc.EaseBackOut.
- * @static
- * @param {cc.ActionInterval} action
- * @return {cc.EaseBackInOut}
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeBackInOut())
- *
- * @example
- * //The old usage
- * cc.EaseBackInOut.create(action);
- * //The new usage
- * action.easing(cc.easeBackInOut());
- */
- cc.EaseBackInOut.create = function (action) {
- return new cc.EaseBackInOut(action);
- };
- cc._easeBackInOutObj = {
- easing: function (time1) {
- var overshoot = 1.70158 * 1.525;
- time1 = time1 * 2;
- if (time1 < 1) {
- return (time1 * time1 * ((overshoot + 1) * time1 - overshoot)) / 2;
- } else {
- time1 = time1 - 2;
- return (time1 * time1 * ((overshoot + 1) * time1 + overshoot)) / 2 + 1;
- }
- },
- reverse: function(){
- return cc._easeBackInOutObj;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Begining of cc.EaseBackIn. Ending of cc.EaseBackOut.
- * @function
- * @return {Object}
- * @example
- * // example
- * action.easing(cc.easeBackInOut());
- */
- cc.easeBackInOut = function(){
- return cc._easeBackInOutObj;
- };
- /**
- * cc.EaseBezierAction action. <br />
- * Manually set a 4 order Bessel curve. <br />
- * According to the set point, calculate the trajectory.
- * @class
- * @extends cc.ActionEase
- * @param {cc.Action} action
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeBezierAction())
- *
- * @example
- * //The old usage
- * var action = cc.EaseBezierAction.create(action);
- * action.setBezierParamer(0.5, 0.5, 1.0, 1.0);
- * //The new usage
- * action.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0));
- */
- cc.EaseBezierAction = cc.ActionEase.extend(/** @lends cc.EaseBezierAction# */{
- _p0: null,
- _p1: null,
- _p2: null,
- _p3: null,
- /**
- * Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function. <br />
- * Initialization requires the application of Bessel curve of action.
- * @param {cc.Action} action
- */
- ctor: function(action){
- cc.ActionEase.prototype.ctor.call(this, action);
- },
- _updateTime: function(a, b, c, d, t){
- return (Math.pow(1-t,3) * a + 3*t*(Math.pow(1-t,2))*b + 3*Math.pow(t,2)*(1-t)*c + Math.pow(t,3)*d );
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- var t = this._updateTime(this._p0, this._p1, this._p2, this._p3, dt);
- this._inner.update(t);
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseBezierAction}
- */
- clone: function(){
- var action = new cc.EaseBezierAction();
- action.initWithAction(this._inner.clone());
- action.setBezierParamer(this._p0, this._p1, this._p2, this._p3);
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseBezierAction}
- */
- reverse: function(){
- var action = new cc.EaseBezierAction(this._inner.reverse());
- action.setBezierParamer(this._p3, this._p2, this._p1, this._p0);
- return action;
- },
- /**
- * Set of 4 reference point
- * @param p0
- * @param p1
- * @param p2
- * @param p3
- */
- setBezierParamer: function(p0, p1, p2, p3){
- this._p0 = p0 || 0;
- this._p1 = p1 || 0;
- this._p2 = p2 || 0;
- this._p3 = p3 || 0;
- }
- });
- /**
- * Creates the action. <br />
- * After creating the cc.EaseBezierAction, also need to manually call setBezierParamer. <br />
- * According to the set point, calculate the trajectory.
- * @static
- * @param action
- * @returns {cc.EaseBezierAction}
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeBezierAction())
- *
- * @example
- * //The old usage
- * var action = cc.EaseBezierAction.create(action);
- * action.setBezierParamer(0.5, 0.5, 1.0, 1.0);
- * //The new usage
- * action.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0));
- */
- cc.EaseBezierAction.create = function(action){
- return new cc.EaseBezierAction(action);
- };
- /**
- * Creates the action easing object. <br />
- * Into the 4 reference point. <br />
- * To calculate the motion curve.
- * @param {Number} p0 The first bezier parameter
- * @param {Number} p1 The second bezier parameter
- * @param {Number} p2 The third bezier parameter
- * @param {Number} p3 The fourth bezier parameter
- * @returns {Object}
- * @example
- * // example
- * action.easing(cc.easeBezierAction(0.5, 0.5, 1.0, 1.0));
- */
- cc.easeBezierAction = function(p0, p1, p2, p3){
- return {
- easing: function(time){
- return cc.EaseBezierAction.prototype._updateTime(p0, p1, p2, p3, time);
- },
- reverse: function(){
- return cc.easeBezierAction(p3, p2, p1, p0);
- }
- };
- };
- /**
- * cc.EaseQuadraticActionIn action. <br />
- * Reference easeInQuad: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuadraticAction())
- *
- * @example
- * //The old usage
- * cc.EaseQuadraticActionIn.create(action);
- * //The new usage
- * action.easing(cc.easeQuadraticActionIn());
- */
- cc.EaseQuadraticActionIn = cc.ActionEase.extend(/** @lends cc.EaseQuadraticActionIn# */{
- _updateTime: function(time){
- return Math.pow(time, 2);
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseQuadraticActionIn}
- */
- clone: function(){
- var action = new cc.EaseQuadraticActionIn();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseQuadraticActionIn}
- */
- reverse: function(){
- return new cc.EaseQuadraticActionIn(this._inner.reverse());
- }
- });
- /**
- * Creates the cc.EaseQuadRaticActionIn. <br />
- * Reference easeInQuad: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- * @param action
- * @returns {cc.EaseQuadraticActionIn}
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuadraticAction())
- *
- * @example
- * //The old usage
- * cc.EaseQuadraticActionIn.create(action);
- * //The new usage
- * action.easing(cc.easeQuadraticActionIn());
- */
- cc.EaseQuadraticActionIn.create = function(action){
- return new cc.EaseQuadraticActionIn(action);
- };
- cc._easeQuadraticActionIn = {
- easing: cc.EaseQuadraticActionIn.prototype._updateTime,
- reverse: function(){
- return cc._easeQuadraticActionIn;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeInQuad: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @returns {Object}
- * @example
- * //example
- * action.easing(cc.easeQuadraticActionIn());
- */
- cc.easeQuadraticActionIn = function(){
- return cc._easeQuadraticActionIn;
- };
- /**
- * cc.EaseQuadraticActionIn action. <br />
- * Reference easeOutQuad: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuadraticActionOut())
- *
- * @example
- * //The old usage
- * cc.EaseQuadraticActionOut.create(action);
- * //The new usage
- * action.easing(cc.easeQuadraticActionOut());
- */
- cc.EaseQuadraticActionOut = cc.ActionEase.extend(/** @lends cc.EaseQuadraticActionOut# */{
- _updateTime: function(time){
- return -time*(time-2);
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseQuadraticActionOut}
- */
- clone: function(){
- var action = new cc.EaseQuadraticActionOut();
- action.initWithAction();
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseQuadraticActionOut}
- */
- reverse: function(){
- return new cc.EaseQuadraticActionOut(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeOutQuad: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- * @param action
- * @returns {cc.EaseQuadraticActionOut}
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuadraticActionOut())
- *
- * @example
- * //The old usage
- * cc.EaseQuadraticActionOut.create(action);
- * //The new usage
- * action.easing(cc.easeQuadraticActionOut());
- */
- cc.EaseQuadraticActionOut.create = function(action){
- return new cc.EaseQuadraticActionOut(action);
- };
- cc._easeQuadraticActionOut = {
- easing: cc.EaseQuadraticActionOut.prototype._updateTime,
- reverse: function(){
- return cc._easeQuadraticActionOut;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeOutQuad: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- * @example
- * //example
- * action.easing(cc.easeQuadraticActionOut());
- */
- cc.easeQuadraticActionOut = function(){
- return cc._easeQuadraticActionOut;
- };
- /**
- * cc.EaseQuadraticActionInOut action. <br />
- * Reference easeInOutQuad: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuadraticActionInOut())
- *
- * @example
- * //The old usage
- * cc.EaseQuadraticActionInOut.create(action);
- * //The new usage
- * action.easing(cc.easeQuadraticActionInOut());
- */
- cc.EaseQuadraticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuadraticActionInOut# */{
- _updateTime: function(time){
- var resultTime = time;
- time *= 2;
- if(time < 1){
- resultTime = time * time * 0.5;
- }else{
- --time;
- resultTime = -0.5 * ( time * ( time - 2 ) - 1)
- }
- return resultTime;
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseQuadraticActionInOut}
- */
- clone: function(){
- var action = new cc.EaseQuadraticActionInOut();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseQuadraticActionInOut}
- */
- reverse: function(){
- return new cc.EaseQuadraticActionInOut(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeInOutQuad: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuadraticActionInOut())
- *
- * @example
- * //The old usage
- * cc.EaseQuadraticActionInOut.create(action);
- * //The new usage
- * action.easing(cc.easeQuadraticActionInOut());
- *
- * @param action
- * @returns {cc.EaseQuadraticActionInOut}
- */
- cc.EaseQuadraticActionInOut.create = function(action){
- return new cc.EaseQuadraticActionInOut(action);
- };
- cc._easeQuadraticActionInOut = {
- easing: cc.EaseQuadraticActionInOut.prototype._updateTime,
- reverse: function(){
- return cc._easeQuadraticActionInOut;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeInOutQuad: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- * @example
- * //example
- * action.easing(cc.easeQuadraticActionInOut());
- */
- cc.easeQuadraticActionInOut = function(){
- return cc._easeQuadraticActionInOut;
- };
- /**
- * cc.EaseQuarticActionIn action. <br />
- * Reference easeInQuart: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuarticActionIn());
- *
- * @example
- * //The old usage
- * cc.EaseQuarticActionIn.create(action);
- * //The new usage
- * action.easing(cc.easeQuarticActionIn());
- */
- cc.EaseQuarticActionIn = cc.ActionEase.extend(/** @lends cc.EaseQuarticActionIn# */{
- _updateTime: function(time){
- return time * time * time * time;
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseQuarticActionIn}
- */
- clone: function(){
- var action = new cc.EaseQuarticActionIn();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseQuarticActionIn}
- */
- reverse: function(){
- return new cc.EaseQuarticActionIn(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeInQuart: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuarticActionIn());
- *
- * @example
- * //The old usage
- * cc.EaseQuarticActionIn.create(action);
- * //The new usage
- * action.easing(cc.easeQuarticActionIn());
- *
- * @param action
- * @returns {cc.EaseQuarticActionIn}
- */
- cc.EaseQuarticActionIn.create = function(action){
- return new cc.EaseQuarticActionIn(action);
- };
- cc._easeQuarticActionIn = {
- easing: cc.EaseQuarticActionIn.prototype._updateTime,
- reverse: function(){
- return cc._easeQuarticActionIn;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeIntQuart: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- * @example
- * //example
- * action.easing(cc.easeQuarticActionIn());
- */
- cc.easeQuarticActionIn = function(){
- return cc._easeQuarticActionIn;
- };
- /**
- * cc.EaseQuarticActionOut action. <br />
- * Reference easeOutQuart: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.QuarticActionOut());
- *
- * @example
- * //The old usage
- * cc.EaseQuarticActionOut.create(action);
- * //The new usage
- * action.easing(cc.EaseQuarticActionOut());
- */
- cc.EaseQuarticActionOut = cc.ActionEase.extend(/** @lends cc.EaseQuarticActionOut# */{
- _updateTime: function(time){
- time -= 1;
- return -(time * time * time * time - 1);
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseQuarticActionOut}
- */
- clone: function(){
- var action = new cc.EaseQuarticActionOut();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseQuarticActionOut}
- */
- reverse: function(){
- return new cc.EaseQuarticActionOut(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeOutQuart: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.QuarticActionOut());
- *
- * @example
- * //The old usage
- * cc.EaseQuarticActionOut.create(action);
- * //The new usage
- * action.easing(cc.EaseQuarticActionOut());
- *
- * @param action
- * @returns {cc.EaseQuarticActionOut}
- */
- cc.EaseQuarticActionOut.create = function(action){
- return new cc.EaseQuarticActionOut(action);
- };
- cc._easeQuarticActionOut = {
- easing: cc.EaseQuarticActionOut.prototype._updateTime,
- reverse: function(){
- return cc._easeQuarticActionOut;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeOutQuart: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- * @example
- * //example
- * action.easing(cc.QuarticActionOut());
- */
- cc.easeQuarticActionOut = function(){
- return cc._easeQuarticActionOut;
- };
- /**
- * cc.EaseQuarticActionInOut action. <br />
- * Reference easeInOutQuart: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuarticActionInOut());
- *
- * @example
- * //The old usage
- * cc.EaseQuarticActionInOut.create(action);
- * //The new usage
- * action.easing(cc.easeQuarticActionInOut());
- */
- cc.EaseQuarticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuarticActionInOut# */{
- _updateTime: function(time){
- time = time*2;
- if (time < 1)
- return 0.5 * time * time * time * time;
- time -= 2;
- return -0.5 * (time * time * time * time - 2);
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseQuarticActionInOut}
- */
- clone: function(){
- var action = new cc.EaseQuarticActionInOut();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseQuarticActionInOut}
- */
- reverse: function(){
- return new cc.EaseQuarticActionInOut(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeInOutQuart: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuarticActionInOut());
- *
- * @example
- * //The old usage
- * cc.EaseQuarticActionInOut.create(action);
- * //The new usage
- * action.easing(cc.easeQuarticActionInOut());
- *
- * @param action
- * @returns {cc.EaseQuarticActionInOut}
- */
- cc.EaseQuarticActionInOut.create = function(action){
- return new cc.EaseQuarticActionInOut(action);
- };
- cc._easeQuarticActionInOut = {
- easing: cc.EaseQuarticActionInOut.prototype._updateTime,
- reverse: function(){
- return cc._easeQuarticActionInOut;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeInOutQuart: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- */
- cc.easeQuarticActionInOut = function(){
- return cc._easeQuarticActionInOut;
- };
- /**
- * cc.EaseQuinticActionIn action. <br />
- * Reference easeInQuint: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuinticActionIn());
- *
- * @example
- * //The old usage
- * cc.EaseQuinticActionIn.create(action);
- * //The new usage
- * action.easing(cc.easeQuinticActionIn());
- */
- cc.EaseQuinticActionIn = cc.ActionEase.extend(/** @lends cc.EaseQuinticActionIn# */{
- _updateTime: function(time){
- return time * time * time * time * time;
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseQuinticActionIn}
- */
- clone: function(){
- var action = new cc.EaseQuinticActionIn();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseQuinticActionIn}
- */
- reverse: function(){
- return new cc.EaseQuinticActionIn(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeInQuint: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuinticActionIn());
- *
- * @example
- * //The old usage
- * cc.EaseQuinticActionIn.create(action);
- * //The new usage
- * action.easing(cc.easeQuinticActionIn());
- *
- * @param action
- * @returns {cc.EaseQuinticActionIn}
- */
- cc.EaseQuinticActionIn.create = function(action){
- return new cc.EaseQuinticActionIn(action);
- };
- cc._easeQuinticActionIn = {
- easing: cc.EaseQuinticActionIn.prototype._updateTime,
- reverse: function(){
- return cc._easeQuinticActionIn;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeInQuint: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- * @example
- * //example
- * action.easing(cc.easeQuinticActionIn());
- */
- cc.easeQuinticActionIn = function(){
- return cc._easeQuinticActionIn;
- };
- /**
- * cc.EaseQuinticActionOut action. <br />
- * Reference easeQuint: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuadraticActionOut());
- *
- * @example
- * //The old usage
- * cc.EaseQuinticActionOut.create(action);
- * //The new usage
- * action.easing(cc.easeQuadraticActionOut());
- */
- cc.EaseQuinticActionOut = cc.ActionEase.extend(/** @lends cc.EaseQuinticActionOut# */{
- _updateTime: function(time){
- time -=1;
- return (time * time * time * time * time + 1);
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseQuinticActionOut}
- */
- clone: function(){
- var action = new cc.EaseQuinticActionOut();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseQuinticActionOut}
- */
- reverse: function(){
- return new cc.EaseQuinticActionOut(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeOutQuint: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuadraticActionOut());
- *
- * @example
- * //The old usage
- * cc.EaseQuinticActionOut.create(action);
- * //The new usage
- * action.easing(cc.easeQuadraticActionOut());
- *
- * @param action
- * @returns {cc.EaseQuinticActionOut}
- */
- cc.EaseQuinticActionOut.create = function(action){
- return new cc.EaseQuinticActionOut(action);
- };
- cc._easeQuinticActionOut = {
- easing: cc.EaseQuinticActionOut.prototype._updateTime,
- reverse: function(){
- return cc._easeQuinticActionOut;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeOutQuint: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- * @example
- * //example
- * action.easing(cc.easeQuadraticActionOut());
- */
- cc.easeQuinticActionOut = function(){
- return cc._easeQuinticActionOut;
- };
- /**
- * cc.EaseQuinticActionInOut action. <br />
- * Reference easeInOutQuint: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuinticActionInOut());
- *
- * @example
- * //The old usage
- * cc.EaseQuinticActionInOut.create(action);
- * //The new usage
- * action.easing(cc.easeQuinticActionInOut());
- */
- cc.EaseQuinticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuinticActionInOut# */{
- _updateTime: function(time){
- time = time*2;
- if (time < 1)
- return 0.5 * time * time * time * time * time;
- time -= 2;
- return 0.5 * (time * time * time * time * time + 2);
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseQuinticActionInOut}
- */
- clone: function(){
- var action = new cc.EaseQuinticActionInOut();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseQuinticActionInOut}
- */
- reverse: function(){
- return new cc.EaseQuinticActionInOut(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeInOutQuint: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeQuinticActionInOut());
- *
- * @example
- * //The old usage
- * cc.EaseQuinticActionInOut.create(action);
- * //The new usage
- * action.easing(cc.easeQuinticActionInOut());
- *
- * @param action
- * @returns {cc.EaseQuinticActionInOut}
- */
- cc.EaseQuinticActionInOut.create = function(action){
- return new cc.EaseQuinticActionInOut(action);
- };
- cc._easeQuinticActionInOut = {
- easing: cc.EaseQuinticActionInOut.prototype._updateTime,
- reverse: function(){
- return cc._easeQuinticActionInOut;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeInOutQuint: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- * @example
- * //example
- * action.easing(cc.easeQuinticActionInOut());
- */
- cc.easeQuinticActionInOut = function(){
- return cc._easeQuinticActionInOut;
- };
- /**
- * cc.EaseCircleActionIn action. <br />
- * Reference easeInCirc: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeCircleActionIn());
- *
- * @example
- * //The old usage
- * cc.EaseCircleActionIn.create(action);
- * //The new usage
- * action.easing(cc.easeCircleActionIn());
- */
- cc.EaseCircleActionIn = cc.ActionEase.extend(/** @lends cc.EaseCircleActionIn# */{
- _updateTime: function(time){
- return -1 * (Math.sqrt(1 - time * time) - 1);
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseCircleActionIn}
- */
- clone: function(){
- var action = new cc.EaseCircleActionIn();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseCircleActionIn}
- */
- reverse: function(){
- return new cc.EaseCircleActionIn(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeInCirc: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeCircleActionIn());
- *
- * @example
- * //The old usage
- * cc.EaseCircleActionIn.create(action);
- * //The new usage
- * action.easing(cc.easeCircleActionIn());
- *
- * @param action
- * @returns {cc.EaseCircleActionIn}
- */
- cc.EaseCircleActionIn.create = function(action){
- return new cc.EaseCircleActionIn(action);
- };
- cc._easeCircleActionIn = {
- easing: cc.EaseCircleActionIn.prototype._updateTime,
- reverse: function(){
- return cc._easeCircleActionIn;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeInCirc: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- * @example
- * //example
- * action.easing(cc.easeCircleActionIn());
- */
- cc.easeCircleActionIn = function(){
- return cc._easeCircleActionIn;
- };
- /**
- * cc.EaseCircleActionOut action. <br />
- * Reference easeOutCirc: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeCircleActionOut());
- *
- * @example
- * //The old usage
- * cc.EaseCircleActionOut.create(action);
- * //The new usage
- * action.easing(cc.easeCircleActionOut());
- */
- cc.EaseCircleActionOut = cc.ActionEase.extend(/** @lends cc.EaseCircleActionOut# */{
- _updateTime: function(time){
- time = time - 1;
- return Math.sqrt(1 - time * time);
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseCircleActionOut}
- */
- clone: function(){
- var action = new cc.EaseCircleActionOut();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseCircleActionOut}
- */
- reverse: function(){
- return new cc.EaseCircleActionOut(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeOutCirc: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeCircleActionOut());
- *
- * @example
- * //The old usage
- * cc.EaseCircleActionOut.create(action);
- * //The new usage
- * action.easing(cc.easeCircleActionOut());
- *
- * @param action
- * @returns {cc.EaseCircleActionOut}
- */
- cc.EaseCircleActionOut.create = function(action){
- return new cc.EaseCircleActionOut(action);
- };
- cc._easeCircleActionOut = {
- easing: cc.EaseCircleActionOut.prototype._updateTime,
- reverse: function(){
- return cc._easeCircleActionOut;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeOutCirc: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- * @exampple
- * //example
- * actioneasing(cc.easeCircleActionOut());
- */
- cc.easeCircleActionOut = function(){
- return cc._easeCircleActionOut;
- };
- /**
- * cc.EaseCircleActionInOut action. <br />
- * Reference easeInOutCirc: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeCircleActionInOut());
- *
- * @example
- * //The old usage
- * cc.EaseCircleActionInOut.create(action);
- * //The new usage
- * action.easing(cc.easeCircleActionInOut());
- */
- cc.EaseCircleActionInOut = cc.ActionEase.extend(/** @lends cc.EaseCircleActionInOut# */{
- _updateTime: function(time){
- time = time * 2;
- if (time < 1)
- return -0.5 * (Math.sqrt(1 - time * time) - 1);
- time -= 2;
- return 0.5 * (Math.sqrt(1 - time * time) + 1);
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseCircleActionInOut}
- */
- clone: function(){
- var action = new cc.EaseCircleActionInOut();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseCircleActionInOut}
- */
- reverse: function(){
- return new cc.EaseCircleActionInOut(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeInOutCirc: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeCircleActionInOut());
- *
- * @example
- * //The old usage
- * cc.EaseCircleActionInOut.create(action);
- * //The new usage
- * action.easing(cc.easeCircleActionInOut());
- *
- * @param action
- * @returns {cc.EaseCircleActionInOut}
- */
- cc.EaseCircleActionInOut.create = function(action){
- return new cc.EaseCircleActionInOut(action);
- };
- cc._easeCircleActionInOut = {
- easing: cc.EaseCircleActionInOut.prototype._updateTime,
- reverse: function(){
- return cc._easeCircleActionInOut;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeInOutCirc: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- * @example
- * //example
- * action.easing(cc.easeCircleActionInOut());
- */
- cc.easeCircleActionInOut = function(){
- return cc._easeCircleActionInOut;
- };
- /**
- * cc.EaseCubicActionIn action. <br />
- * Reference easeInCubic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> action.easing(cc.easeCubicActionIn());
- *
- * @example
- * //The old usage
- * cc.EaseCubicActionIn.create(action);
- * //The new usage
- * action.easing(cc.easeCubicActionIn());
- */
- cc.EaseCubicActionIn = cc.ActionEase.extend(/** @lends cc.EaseCubicActionIn# */{
- _updateTime: function(time){
- return time * time * time;
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseCubicActionIn}
- */
- clone: function(){
- var action = new cc.EaseCubicActionIn();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseCubicActionIn}
- */
- reverse: function(){
- return new cc.EaseCubicActionIn(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeInCubic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- *
- * @deprecated since v3.0 <br /> action.easing(cc.easeCubicActionIn());
- *
- * @example
- * //The old usage
- * cc.EaseCubicActionIn.create(action);
- * //The new usage
- * action.easing(cc.easeCubicActionIn());
- *
- * @param action
- * @returns {cc.EaseCubicActionIn}
- */
- cc.EaseCubicActionIn.create = function(action){
- return new cc.EaseCubicActionIn(action);
- };
- cc._easeCubicActionIn = {
- easing: cc.EaseCubicActionIn.prototype._updateTime,
- reverse: function(){
- return cc._easeCubicActionIn;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeInCubic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- * @example
- * //example
- * action.easing(cc.easeCubicActionIn());
- */
- cc.easeCubicActionIn = function(){
- return cc._easeCubicActionIn;
- };
- /**
- * cc.EaseCubicActionOut action. <br />
- * Reference easeOutCubic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeCubicActionOut());
- *
- * @example
- * //The old usage
- * cc.EaseCubicActionOut.create(action);
- * //The new usage
- * action.easing(cc.easeCubicActionOut());
- */
- cc.EaseCubicActionOut = cc.ActionEase.extend(/** @lends cc.EaseCubicActionOut# */{
- _updateTime: function(time){
- time -= 1;
- return (time * time * time + 1);
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseCubicActionOut}
- */
- clone: function(){
- var action = new cc.EaseCubicActionOut();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseCubicActionOut}
- */
- reverse: function(){
- return new cc.EaseCubicActionOut(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeOutCubic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeCubicActionOut());
- *
- * @example
- * //The old usage
- * cc.EaseCubicActionOut.create(action);
- * //The new usage
- * action.easing(cc.easeCubicActionOut());
- *
- * @param action
- * @returns {cc.EaseCubicActionOut}
- */
- cc.EaseCubicActionOut.create = function(action){
- return new cc.EaseCubicActionOut(action);
- };
- cc._easeCubicActionOut = {
- easing: cc.EaseCubicActionOut.prototype._updateTime,
- reverse: function(){
- return cc._easeCubicActionOut;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeOutCubic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- * @example
- * //example
- * action.easing(cc.easeCubicActionOut());
- */
- cc.easeCubicActionOut = function(){
- return cc._easeCubicActionOut;
- };
- /**
- * cc.EaseCubicActionInOut action. <br />
- * Reference easeInOutCubic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @class
- * @extends cc.ActionEase
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeCubicActionInOut());
- *
- * @example
- * //The old usage
- * cc.EaseCubicActionInOut.create(action);
- * //The new usage
- * action.easing(cc.easeCubicActionInOut());
- */
- cc.EaseCubicActionInOut = cc.ActionEase.extend(/** @lends cc.EaseCubicActionInOut# */{
- _updateTime: function(time){
- time = time*2;
- if (time < 1)
- return 0.5 * time * time * time;
- time -= 2;
- return 0.5 * (time * time * time + 2);
- },
- /**
- * Called once per frame. Time is the number of seconds of a frame interval.
- *
- * @param {Number} dt
- */
- update: function(dt){
- this._inner.update(this._updateTime(dt));
- },
- /**
- * to copy object with deep copy.
- * returns a clone of action.
- *
- * @returns {cc.EaseCubicActionInOut}
- */
- clone: function(){
- var action = new cc.EaseCubicActionInOut();
- action.initWithAction(this._inner.clone());
- return action;
- },
- /**
- * Create a action. Opposite with the original motion trajectory.
- * @return {cc.EaseCubicActionInOut}
- */
- reverse: function(){
- return new cc.EaseCubicActionInOut(this._inner.reverse());
- }
- });
- /**
- * Creates the action. <br />
- * Reference easeInOutCubic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @static
- *
- * @deprecated since v3.0 <br /> Please use action.easing(cc.easeCubicActionInOut());
- *
- * @example
- * //The old usage
- * cc.EaseCubicActionInOut.create(action);
- * //The new usage
- * action.easing(cc.easeCubicActionInOut());
- *
- * @param action
- * @returns {cc.EaseCubicActionInOut}
- */
- cc.EaseCubicActionInOut.create = function(action){
- return new cc.EaseCubicActionInOut(action);
- };
- cc._easeCubicActionInOut = {
- easing: cc.EaseCubicActionInOut.prototype._updateTime,
- reverse: function(){
- return cc._easeCubicActionInOut;
- }
- };
- /**
- * Creates the action easing object. <br />
- * Reference easeInOutCubic: <br />
- * {@link http://www.zhihu.com/question/21981571/answer/19925418}
- * @function
- * @returns {Object}
- */
- cc.easeCubicActionInOut = function(){
- return cc._easeCubicActionInOut;
- };
|