1 /****************************************************************************
  2  Copyright (c) 2008-2010 Ricardo Quesada
  3  Copyright (c) 2011-2012 cocos2d-x.org
  4  Copyright (c) 2013-2014 Chukong Technologies Inc.
  5 
  6  http://www.cocos2d-x.org
  7 
  8  Permission is hereby granted, free of charge, to any person obtaining a copy
  9  of this software and associated documentation files (the "Software"), to deal
 10  in the Software without restriction, including without limitation the rights
 11  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 12  copies of the Software, and to permit persons to whom the Software is
 13  furnished to do so, subject to the following conditions:
 14 
 15  The above copyright notice and this permission notice shall be included in
 16  all copies or substantial portions of the Software.
 17 
 18  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 19  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 20  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 21  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 22  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 23  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 24  THE SOFTWARE.
 25  ****************************************************************************/
 26 
 27 /**
 28  * Base class for Easing actions
 29  * @class
 30  * @extends cc.ActionInterval
 31  */
 32 
 33 cc.ActionEase = cc.ActionInterval.extend(/** @lends cc.ActionEase# */{
 34     _inner:null,
 35 
 36 	/**
 37 	 * creates the action of ActionEase
 38 	 *
 39 	 * Constructor of cc.ActionEase
 40 	 * @param {cc.ActionInterval} action
 41 	 *
 42 	 * @example
 43 	 * var moveEase = new cc.ActionEase(action);
 44 	 */
 45     ctor: function (action) {
 46         cc.ActionInterval.prototype.ctor.call(this);
 47         action && this.initWithAction(action);
 48     },
 49 
 50     /** initializes the action
 51      * @param {cc.ActionInterval} action
 52      * @return {Boolean}
 53      */
 54     initWithAction:function (action) {
 55         if(!action)
 56             throw "cc.ActionEase.initWithAction(): action must be non nil";
 57 
 58         if (this.initWithDuration(action.getDuration())) {
 59             this._inner = action;
 60             return true;
 61         }
 62         return false;
 63     },
 64 
 65     clone:function(){
 66        var action = new cc.ActionEase();
 67         action.initWithAction(this._inner.clone());
 68         return action;
 69     },
 70 
 71     /**
 72      * @param {cc.Node} target
 73      */
 74     startWithTarget:function (target) {
 75         cc.ActionInterval.prototype.startWithTarget.call(this, target);
 76         this._inner.startWithTarget(this.target);
 77     },
 78 
 79     /**
 80      * Stop the action.
 81      */
 82     stop:function () {
 83         this._inner.stop();
 84         cc.ActionInterval.prototype.stop.call(this);
 85     },
 86 
 87     /**
 88      * @param {Number} time1
 89      */
 90     update:function (time1) {
 91         this._inner.update(time1);
 92     },
 93 
 94     /**
 95      * @return {cc.ActionInterval}
 96      */
 97     reverse:function () {
 98         return cc.ActionEase.create(this._inner.reverse());
 99     },
100 
101     getInnerAction:function(){
102        return this._inner;
103     }
104 });
105 
106 /** creates the action of ActionEase
107  * @param {cc.ActionInterval} action
108  * @return {cc.ActionEase}
109  * @example
110  * // example
111  * var moveEase = cc.actionEase(action);
112  */
113 cc.actionEase = function (action) {
114     return new cc.ActionEase(action);
115 };
116 /**
117  * Please use cc.actionEase instead
118  * creates the action of ActionEase
119  * @param {cc.ActionInterval} action
120  * @return {cc.ActionEase}
121  * @static
122  * @deprecated
123  */
124 cc.ActionEase.create = cc.actionEase;
125 
126 /**
127  * Base class for Easing actions with rate parameters
128  * @class
129  * @extends cc.ActionEase
130  */
131 cc.EaseRateAction = cc.ActionEase.extend(/** @lends cc.EaseRateAction# */{
132     _rate:0,
133 
134 	/**
135 	 * Creates the action with the inner action and the rate parameter
136 	 *
137 	 * Constructor of cc.EaseRateAction
138 	 * @param {cc.ActionInterval} action
139 	 * @param {Number} rate
140 	 *
141 	 * @example
142 	 * // example
143 	 * var moveEaseRateAction = new cc.EaseRateAction(action, 3.0);
144 	 */
145     ctor: function(action, rate){
146         cc.ActionEase.prototype.ctor.call(this);
147 
148 		rate !== undefined && this.initWithAction(action, rate);
149     },
150 
151     /** set rate value for the actions
152      * @param {Number} rate
153      */
154     setRate:function (rate) {
155         this._rate = rate;
156     },
157 
158     /** get rate value for the actions
159      * @return {Number}
160      */
161     getRate:function () {
162         return this._rate;
163     },
164 
165     /**
166      * Initializes the action with the inner action and the rate parameter
167      * @param {cc.ActionInterval} action
168      * @param {Number} rate
169      * @return {Boolean}
170      */
171     initWithAction:function (action, rate) {
172         if (cc.ActionEase.prototype.initWithAction.call(this, action)) {
173             this._rate = rate;
174             return true;
175         }
176         return false;
177     },
178 
179     clone:function(){
180         var action = new cc.EaseRateAction();
181         action.initWithAction(this._inner.clone(), this._rate);
182         return action;
183     },
184 
185     /**
186      * @return {cc.EaseRateAction}
187      */
188     reverse:function () {
189         return cc.EaseRateAction.create(this._inner.reverse(), 1 / this._rate);
190     }
191 });
192 
193 /** Creates the action with the inner action and the rate parameter
194  * @param {cc.ActionInterval} action
195  * @param {Number} rate
196  * @return {cc.EaseRateAction}
197  * @example
198  * // example
199  * var moveEaseRateAction = cc.easeRateAction(action, 3.0);
200  */
201 cc.easeRateAction = function (action, rate) {
202     return new cc.EaseRateAction(action, rate);
203 };
204 /**
205  * Please use cc.easeRateAction instead
206  * Creates the action with the inner action and the rate parameter
207  * @param {cc.ActionInterval} action
208  * @param {Number} rate
209  * @return {cc.EaseRateAction}
210  * @static
211  * @deprecated
212  */
213 cc.EaseRateAction.create = cc.easeRateAction;
214 
215 /**
216  * cc.EaseIn action with a rate
217  * @class
218  * @extends cc.EaseRateAction
219  */
220 cc.EaseIn = cc.EaseRateAction.extend(/** @lends cc.EaseIn# */{
221     /**
222      * @param {Number} time1
223      */
224     update:function (time1) {
225         this._inner.update(Math.pow(time1, this._rate));
226     },
227 
228     /**
229      * @return {cc.EaseIn}
230      */
231     reverse:function () {
232         return cc.EaseIn.create(this._inner.reverse(), 1 / this._rate);
233     },
234 
235     clone:function(){
236         var action = new cc.EaseIn();
237         action.initWithAction(this._inner.clone(), this._rate);
238         return action;
239     }
240 });
241 
242 /**
243  * Creates the action with the inner action and the rate parameter
244  * @static
245  * @deprecated
246  * @param {cc.ActionInterval} action
247  * @param {Number} rate
248  * @return {cc.EaseIn}
249  */
250 cc.EaseIn.create = function (action, rate) {
251     return new cc.EaseIn(action, rate);
252 };
253 
254 /** Creates the action easing object with the rate parameter
255  * @function
256  * @param {Number} rate
257  * @return {Object}
258  * @example
259  * // example
260  * action.easing(cc.easeIn(3.0));
261  */
262 cc.easeIn = function (rate) {
263     return {
264         _rate: rate,
265         easing: function (dt) {
266             return Math.pow(dt, this._rate);
267         },
268         reverse: function(){
269             return cc.easeIn(1 / this._rate);
270         }
271     };
272 };
273 
274 /**
275  * cc.EaseOut action with a rate
276  * @class
277  * @extends cc.EaseRateAction
278  */
279 cc.EaseOut = cc.EaseRateAction.extend(/** @lends cc.EaseOut# */{
280     /**
281      * @param {Number} time1
282      */
283     update:function (time1) {
284         this._inner.update(Math.pow(time1, 1 / this._rate));
285     },
286 
287     /**
288      * @return {cc.EaseOut}
289      */
290     reverse:function () {
291         return cc.EaseOut.create(this._inner.reverse(), 1 / this._rate);
292     },
293 
294     clone:function(){
295         var action = new cc.EaseOut();
296         action.initWithAction(this._inner.clone(),this._rate);
297         return action;
298     }
299 });
300 
301 /** Creates the action with the inner action and the rate parameter
302  * @static
303  * @deprecated
304  * @param {cc.ActionInterval} action
305  * @param {Number} rate
306  * @return {cc.EaseOut}
307  */
308 cc.EaseOut.create = function (action, rate) {
309     return new cc.EaseOut(action, rate);
310 };
311 
312 /** Creates the action easing object with the rate parameter
313  * @function
314  * @param {Number} rate
315  * @return {Object}
316  * @example
317  * // example
318  * action.easing(cc.easeOut(3.0));
319  */
320 cc.easeOut = function (rate) {
321     return {
322         _rate: rate,
323         easing: function (dt) {
324             return Math.pow(dt, 1 / this._rate);
325         },
326         reverse: function(){
327             return cc.easeOut(1 / this._rate)
328         }
329     };
330 };
331 
332 /**
333  * cc.EaseInOut action with a rate
334  * @class
335  * @extends cc.EaseRateAction
336  */
337 cc.EaseInOut = cc.EaseRateAction.extend(/** @lends cc.EaseInOut# */{
338     /**
339      * @param {Number} time1
340      */
341     update:function (time1) {
342         time1 *= 2;
343         if (time1 < 1)
344             this._inner.update(0.5 * Math.pow(time1, this._rate));
345         else
346             this._inner.update(1.0 - 0.5 * Math.pow(2 - time1, this._rate));
347     },
348 
349     clone:function(){
350         var action = new cc.EaseInOut();
351         action.initWithAction(this._inner.clone(), this._rate);
352         return action;
353     },
354 
355     /**
356      * @return {cc.EaseInOut}
357      */
358     reverse:function () {
359         return cc.EaseInOut.create(this._inner.reverse(), this._rate);
360     }
361 });
362 
363 /** Creates the action with the inner action and the rate parameter
364  * @static
365  * @deprecated
366  * @param {cc.ActionInterval} action
367  * @param {Number} rate
368  * @return {cc.EaseInOut}
369  */
370 cc.EaseInOut.create = function (action, rate) {
371     return new cc.EaseInOut(action, rate);
372 };
373 
374 /** Creates the action easing object with the rate parameter
375  * @function
376  * @param {Number} rate
377  * @return {Object}
378  * @example
379  * // example
380  * action.easing(cc.easeInOut(3.0));
381  */
382 cc.easeInOut = function (rate) {
383     return {
384         _rate: rate,
385         easing: function (dt) {
386             dt *= 2;
387             if (dt < 1)
388                 return 0.5 * Math.pow(dt, this._rate);
389             else
390                 return 1.0 - 0.5 * Math.pow(2 - dt, this._rate);
391         },
392         reverse: function(){
393             return cc.easeInOut(this._rate);
394         }
395     };
396 };
397 
398 /**
399  * cc.Ease Exponential In
400  * @class
401  * @extends cc.ActionEase
402  */
403 cc.EaseExponentialIn = cc.ActionEase.extend(/** @lends cc.EaseExponentialIn# */{
404     /**
405      * @param {Number} time1
406      */
407     update:function (time1) {
408         this._inner.update(time1 === 0 ? 0 : Math.pow(2, 10 * (time1 - 1)));
409     },
410 
411     /**
412      * @return {cc.EaseExponentialOut}
413      */
414     reverse:function () {
415         return cc.EaseExponentialOut.create(this._inner.reverse());
416     },
417 
418     clone:function(){
419         var action = new cc.EaseExponentialIn();
420         action.initWithAction(this._inner.clone());
421         return action;
422     }
423 });
424 
425 /** creates the action
426  * @static
427  * @deprecated
428  * @param {cc.ActionInterval} action
429  * @return {cc.EaseExponentialIn}
430  */
431 cc.EaseExponentialIn.create = function (action) {
432     return new cc.EaseExponentialIn(action);
433 };
434 
435 cc._easeExponentialInObj = {
436     easing: function(dt){
437         return dt === 0 ? 0 : Math.pow(2, 10 * (dt - 1));
438     },
439     reverse: function(){
440         return cc._easeExponentialOutObj;
441     }
442 };
443 
444 /** creates the action easing object
445  * @function
446  * @return {Object}
447  * @example
448  * // example
449  * action.easing(cc.easeExponentialIn());
450  */
451 cc.easeExponentialIn = function(){
452     return cc._easeExponentialInObj;
453 };
454 
455 /**
456  * Ease Exponential Out
457  * @class
458  * @extends cc.ActionEase
459  */
460 cc.EaseExponentialOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialOut# */{
461     /**
462      * @param {Number} time1
463      */
464     update:function (time1) {
465         this._inner.update(time1 == 1 ? 1 : (-(Math.pow(2, -10 * time1)) + 1));
466     },
467 
468     /**
469      * @return {cc.EaseExponentialIn}
470      */
471     reverse:function () {
472         return cc.EaseExponentialIn.create(this._inner.reverse());
473     },
474 
475     clone:function(){
476         var action = new cc.EaseExponentialOut();
477         action.initWithAction(this._inner.clone());
478         return action;
479     }
480 });
481 
482 /** creates the action
483  * @static
484  * @deprecated
485  * @param {cc.ActionInterval} action
486  * @return {cc.EaseExponentialOut}
487  */
488 cc.EaseExponentialOut.create = function (action) {
489     return new cc.EaseExponentialOut(action);
490 };
491 
492 cc._easeExponentialOutObj = {
493     easing: function(dt){
494         return dt == 1 ? 1 : (-(Math.pow(2, -10 * dt)) + 1);
495     },
496     reverse: function(){
497         return cc._easeExponentialInObj;
498     }
499 };
500 /** creates the action easing object
501  * @return {cc.EaseExponentialOut}
502  * @example
503  * // example
504  * action.easing(cc.easeExponentialOut());
505  */
506 cc.easeExponentialOut = function(){
507     return cc._easeExponentialOutObj;
508 };
509 
510 /**
511  * Ease Exponential InOut
512  * @class
513  * @extends cc.ActionEase
514  */
515 cc.EaseExponentialInOut = cc.ActionEase.extend(/** @lends cc.EaseExponentialInOut# */{
516     /**
517      * @param {Number} time
518      */
519     update:function (time) {
520         if( time != 1 && time !== 0) {
521             time *= 2;
522             if (time < 1)
523                 time = 0.5 * Math.pow(2, 10 * (time - 1));
524             else
525                 time = 0.5 * (-Math.pow(2, -10 * (time - 1)) + 2);
526         }
527         this._inner.update(time);
528     },
529 
530     /**
531      * @return {cc.EaseExponentialInOut}
532      */
533     reverse:function () {
534         return cc.EaseExponentialInOut.create(this._inner.reverse());
535     },
536 
537     clone:function(){
538         var action = new cc.EaseExponentialInOut();
539         action.initWithAction(this._inner.clone());
540         return action;
541     }
542 });
543 
544 /** creates an EaseExponentialInOut action
545  * @static
546  * @deprecated
547  * @param {cc.ActionInterval} action
548  * @return {cc.EaseExponentialInOut}
549  */
550 cc.EaseExponentialInOut.create = function (action) {
551     return new cc.EaseExponentialInOut(action);
552 };
553 
554 cc._easeExponentialInOutObj = {
555     easing: function(dt){
556         if( dt !== 1 && dt !== 0) {
557             dt *= 2;
558             if (dt < 1)
559                 return 0.5 * Math.pow(2, 10 * (dt - 1));
560             else
561                 return 0.5 * (-Math.pow(2, -10 * (dt - 1)) + 2);
562         }
563         return dt;
564     },
565     reverse: function(){
566         return cc._easeExponentialInOutObj;
567     }
568 };
569 /**
570  * creates an EaseExponentialInOut action easing object
571  * @function
572  * @return {Object}
573  * @example
574  * // example
575  * action.easing(cc.easeExponentialInOut());
576  */
577 cc.easeExponentialInOut = function(){
578     return cc._easeExponentialInOutObj;
579 };
580 
581 /**
582  * Ease Sine In
583  * @class
584  * @extends cc.ActionEase
585  */
586 cc.EaseSineIn = cc.ActionEase.extend(/** @lends cc.EaseSineIn# */{
587     /**
588      * @param {Number} time1
589      */
590     update:function (time1) {
591         time1 = time1===0 || time1===1 ? time1 : -1 * Math.cos(time1 * Math.PI / 2) + 1;
592         this._inner.update(time1);
593     },
594 
595     /**
596      * @return {cc.EaseSineOut}
597      */
598     reverse:function () {
599         return cc.EaseSineOut.create(this._inner.reverse());
600     },
601 
602     clone:function(){
603         var action = new cc.EaseSineIn();
604         action.initWithAction(this._inner.clone());
605         return action;
606     }
607 });
608 
609 /** creates an EaseSineIn action
610  * @static
611  * @deprecated
612  * @param {cc.ActionInterval} action
613  * @return {cc.EaseSineIn}
614  */
615 cc.EaseSineIn.create = function (action) {
616     return new cc.EaseSineIn(action);
617 };
618 
619 cc._easeSineInObj = {
620     easing: function(dt){
621         return (dt===0 || dt===1) ? dt : -1 * Math.cos(dt * Math.PI / 2) + 1;
622     },
623     reverse: function(){
624         return cc._easeSineOutObj;
625     }
626 };
627 /** creates an EaseSineIn action
628  * @function
629  * @return {Object}
630  * @example
631  * // example
632  * action.easing(cc.easeSineIn());
633  */
634 cc.easeSineIn = function(){
635     return cc._easeSineInObj;
636 };
637 
638 /**
639  * Ease Sine Out
640  * @class
641  * @extends cc.ActionEase
642  */
643 cc.EaseSineOut = cc.ActionEase.extend(/** @lends cc.EaseSineOut# */{
644     /**
645      * @param {Number} time1
646      */
647     update:function (time1) {
648         time1 = time1===0 || time1===1 ? time1 : Math.sin(time1 * Math.PI / 2);
649         this._inner.update(time1);
650     },
651 
652     /**
653      * @return {cc.EaseSineIn}
654      */
655     reverse:function () {
656         return cc.EaseSineIn.create(this._inner.reverse());
657     },
658 
659     clone:function(){
660         var action = new cc.EaseSineOut();
661         action.initWithAction(this._inner.clone());
662         return action;
663     }
664 });
665 
666 /** creates an EaseSineOut action
667  * @static
668  * @deprecated
669  * @param {cc.ActionInterval} action
670  * @return {cc.EaseSineOut}
671  */
672 cc.EaseSineOut.create = function (action) {
673     return new cc.EaseSineOut(action);
674 };
675 
676 cc._easeSineOutObj = {
677     easing: function(dt){
678         return (dt===0 || dt==1) ? dt : Math.sin(dt * Math.PI / 2);
679     },
680     reverse: function(){
681         return cc._easeSineInObj;
682     }
683 };
684 /** creates an EaseSineOut action easing object
685  * @function
686  * @return {Object}
687  * @example
688  * // example
689  * action.easing(cc.easeSineOut());
690  */
691 cc.easeSineOut = function(){
692     return cc._easeSineOutObj;
693 };
694 
695 /**
696  * Ease Sine InOut
697  * @class
698  * @extends cc.ActionEase
699  */
700 cc.EaseSineInOut = cc.ActionEase.extend(/** @lends cc.EaseSineInOut# */{
701     /**
702      * @param {Number} time1
703      */
704     update:function (time1) {
705         time1 = time1===0 || time1===1 ? time1 : -0.5 * (Math.cos(Math.PI * time1) - 1);
706         this._inner.update(time1);
707     },
708 
709     clone:function(){
710         var action = new cc.EaseSineInOut();
711         action.initWithAction(this._inner.clone());
712         return action;
713     },
714 
715     /**
716      * @return {cc.EaseSineInOut}
717      */
718     reverse:function () {
719         return cc.EaseSineInOut.create(this._inner.reverse());
720     }
721 });
722 
723 /** creates the action
724  * @static
725  * @deprecated
726  * @param {cc.ActionInterval} action
727  * @return {cc.EaseSineInOut}
728  */
729 cc.EaseSineInOut.create = function (action) {
730     return new cc.EaseSineInOut(action);
731 };
732 
733 cc._easeSineInOutObj = {
734     easing: function(dt){
735         return (dt === 0 || dt === 1) ? dt : -0.5 * (Math.cos(Math.PI * dt) - 1);
736     },
737     reverse: function(){
738         return cc._easeSineInOutObj;
739     }
740 };
741 /**
742  * creates the action easing object
743  * @return {cc.EaseSineInOut}
744  * @example
745  * // example
746  * action.easing(cc.easeSineInOut());
747  */
748 cc.easeSineInOut = function(){
749     return cc._easeSineInOutObj;
750 };
751 
752 /**
753  * Ease Elastic abstract class
754  * @class
755  * @extends cc.ActionEase
756  */
757 cc.EaseElastic = cc.ActionEase.extend(/** @lends cc.EaseElastic# */{
758     _period: 0.3,
759 
760 	/** Creates the action with the inner action and the period in radians (default is 0.3)
761 	 *
762 	 * Constructor of cc.EaseElastic
763 	 * @param {cc.ActionInterval} action
764 	 * @param {Number} [period=0.3]
765 	 *
766 	 * @example
767 	 * // example
768 	 * var moveEaseElastic = new cc.EaseElastic(action, 3.0);
769 	 */
770     ctor:function(action, period){
771         cc.ActionEase.prototype.ctor.call(this);
772 
773 		action && this.initWithAction(action, period);
774     },
775 
776     /** get period of the wave in radians. default is 0.3
777      * @return {Number}
778      */
779     getPeriod:function () {
780         return this._period;
781     },
782 
783     /** set period of the wave in radians.
784      * @param {Number} period
785      */
786     setPeriod:function (period) {
787         this._period = period;
788     },
789 
790     /** Initializes the action with the inner action and the period in radians (default is 0.3)
791      * @param {cc.ActionInterval} action
792      * @param {Number} [period=0.3]
793      * @return {Boolean}
794      */
795     initWithAction:function (action, period) {
796         cc.ActionEase.prototype.initWithAction.call(this, action);
797         this._period = (period == null) ? 0.3 : period;
798         return true;
799     },
800 
801     /**
802      * @return {Null}
803      */
804     reverse:function () {
805         cc.log("cc.EaseElastic.reverse(): it should be overridden in subclass.");
806         return null;
807     },
808 
809     clone:function(){
810         var action = new cc.EaseElastic();
811         action.initWithAction(this._inner.clone(), this._period);
812         return action;
813     }
814 });
815 
816 /** Creates the action with the inner action and the period in radians (default is 0.3)
817  * @static
818  * @deprecated
819  * @param {cc.ActionInterval} action
820  * @param {Number} [period=0.3]
821  * @return {cc.EaseElastic}
822  */
823 cc.EaseElastic.create = function (action, period) {
824     return new cc.EaseElastic(action, period);
825 };
826 
827 /**
828  * Ease Elastic In action.
829  * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
830  * @class
831  * @extends cc.EaseElastic
832  */
833 cc.EaseElasticIn = cc.EaseElastic.extend(/** @lends cc.EaseElasticIn# */{
834     /**
835      * @param {Number} time1
836      */
837     update:function (time1) {
838         var newT = 0;
839         if (time1 === 0 || time1 === 1) {
840             newT = time1;
841         } else {
842             var s = this._period / 4;
843             time1 = time1 - 1;
844             newT = -Math.pow(2, 10 * time1) * Math.sin((time1 - s) * Math.PI * 2 / this._period);
845         }
846         this._inner.update(newT);
847     },
848 
849     /**
850      * @return {cc.EaseElasticOut}
851      */
852     reverse:function () {
853         return cc.EaseElasticOut.create(this._inner.reverse(), this._period);
854     },
855 
856     clone:function(){
857         var action = new cc.EaseElasticIn();
858         action.initWithAction(this._inner.clone(), this._period);
859         return action;
860     }
861 });
862 
863 /** Creates the action with the inner action and the period in radians (default is 0.3)
864  * @deprecated
865  * @param {cc.ActionInterval} action
866  * @param {Number} [period=0.3]
867  * @return {cc.EaseElasticIn}
868  */
869 cc.EaseElasticIn.create = function (action, period) {
870     return new cc.EaseElasticIn(action, period);
871 };
872 
873 //default ease elastic in object (period = 0.3)
874 cc._easeElasticInObj = {
875    easing:function(dt){
876        if (dt === 0 || dt === 1)
877            return dt;
878        dt = dt - 1;
879        return -Math.pow(2, 10 * dt) * Math.sin((dt - (0.3 / 4)) * Math.PI * 2 / 0.3);
880    },
881     reverse:function(){
882         return cc._easeElasticOutObj;
883     }
884 };
885 
886 /** Creates the action easing obejct with the period in radians (default is 0.3)
887  * @function
888  * @param {Number} [period=0.3]
889  * @return {Object}
890  * @example
891  * // example
892  * action.easing(cc.easeElasticIn(3.0));
893  */
894 cc.easeElasticIn = function (period) {
895     if(period && period !== 0.3){
896         return {
897             _period: period,
898             easing: function (dt) {
899                 if (dt === 0 || dt === 1)
900                     return dt;
901                 dt = dt - 1;
902                 return -Math.pow(2, 10 * dt) * Math.sin((dt - (this._period / 4)) * Math.PI * 2 / this._period);
903             },
904             /**
905              * @return {cc.EaseElasticIn}
906              */
907             reverse:function () {
908                 return cc.easeElasticOut(this._period);
909             }
910         };
911     }
912     return cc._easeElasticInObj;
913 };
914 
915 /**
916  * Ease Elastic Out action.
917  * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
918  * @class
919  * @extends cc.EaseElastic
920  */
921 cc.EaseElasticOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticOut# */{
922     /**
923      * @param {Number} time1
924      */
925     update:function (time1) {
926         var newT = 0;
927         if (time1 === 0 || time1 == 1) {
928             newT = time1;
929         } else {
930             var s = this._period / 4;
931             newT = Math.pow(2, -10 * time1) * Math.sin((time1 - s) * Math.PI * 2 / this._period) + 1;
932         }
933 
934         this._inner.update(newT);
935     },
936 
937     /**
938      * @return {cc.EaseElasticIn}
939      */
940     reverse:function () {
941         return cc.EaseElasticIn.create(this._inner.reverse(), this._period);
942     },
943 
944     clone:function(){
945         var action = new cc.EaseElasticOut();
946         action.initWithAction(this._inner.clone(), this._period);
947         return action;
948     }
949 });
950 
951 /** Creates the action with the inner action and the period in radians (default is 0.3)
952  * @deprecated
953  * @param {cc.ActionInterval} action
954  * @param {Number} [period=0.3]
955  * @return {cc.EaseElasticOut}
956  */
957 cc.EaseElasticOut.create = function (action, period) {
958     return new cc.EaseElasticOut(action, period);
959 };
960 
961 //default ease elastic out object (period = 0.3)
962 cc._easeElasticOutObj = {
963     easing: function (dt) {
964         return (dt === 0 || dt === 1) ? dt : Math.pow(2, -10 * dt) * Math.sin((dt - (0.3 / 4)) * Math.PI * 2 / 0.3) + 1;
965     },
966     reverse:function(){
967         return cc._easeElasticInObj;
968     }
969 };
970 /** Creates the action easing object with the period in radians (default is 0.3)
971  * @function
972  * @param {Number} [period=0.3]
973  * @return {Object}
974  * @example
975  * // example
976  * action.easing(cc.easeElasticOut(3.0));
977  */
978 cc.easeElasticOut = function (period) {
979     if(period && period !== 0.3){
980         return {
981             _period: period,
982             easing: function (dt) {
983                 return (dt === 0 || dt === 1) ? dt : Math.pow(2, -10 * dt) * Math.sin((dt - (this._period / 4)) * Math.PI * 2 / this._period) + 1;
984             },
985             reverse:function(){
986                 return cc.easeElasticIn(this._period);
987             }
988         };
989     }
990     return cc._easeElasticOutObj;
991 };
992 
993 /**
994  * Ease Elastic InOut action.
995  * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
996  * @class
997  * @extends cc.EaseElastic
998  */
999 cc.EaseElasticInOut = cc.EaseElastic.extend(/** @lends cc.EaseElasticInOut# */{
1000     /**
1001      * @param {Number} time1
1002      */
1003     update:function (time1) {
1004         var newT = 0;
1005         var locPeriod = this._period;
1006         if (time1 === 0 || time1 == 1) {
1007             newT = time1;
1008         } else {
1009             time1 = time1 * 2;
1010             if (!locPeriod)
1011                 locPeriod = this._period = 0.3 * 1.5;
1012 
1013             var s = locPeriod / 4;
1014             time1 = time1 - 1;
1015             if (time1 < 0)
1016                 newT = -0.5 * Math.pow(2, 10 * time1) * Math.sin((time1 - s) * Math.PI * 2 / locPeriod);
1017             else
1018                 newT = Math.pow(2, -10 * time1) * Math.sin((time1 - s) * Math.PI * 2 / locPeriod) * 0.5 + 1;
1019         }
1020         this._inner.update(newT);
1021     },
1022 
1023     /**
1024      * @return {cc.EaseElasticInOut}
1025      */
1026     reverse:function () {
1027         return cc.EaseElasticInOut.create(this._inner.reverse(), this._period);
1028     },
1029 
1030     clone:function(){
1031         var action = new cc.EaseElasticInOut();
1032         action.initWithAction(this._inner.clone(), this._period);
1033         return action;
1034     }
1035 });
1036 
1037 /** Creates the action with the inner action and the period in radians (default is 0.3)
1038  * @deprecated
1039  * @param {cc.ActionInterval} action
1040  * @param {Number} [period=0.3]
1041  * @return {cc.EaseElasticInOut}
1042  */
1043 cc.EaseElasticInOut.create = function (action, period) {
1044     return new cc.EaseElasticInOut(action, period);
1045 };
1046 
1047 /** Creates the action easing object with the period in radians (default is 0.3)
1048  * @function
1049  * @param {Number} [period=0.3]
1050  * @return {Object}
1051  * @example
1052  * // example
1053  * action.easing(cc.easeElasticInOut(3.0));
1054  */
1055 cc.easeElasticInOut = function (period) {
1056     period = period || 0.3;
1057     return {
1058         _period: period,
1059         easing: function (dt) {
1060             var newT = 0;
1061             var locPeriod = this._period;
1062             if (dt === 0 || dt === 1) {
1063                 newT = dt;
1064             } else {
1065                 dt = dt * 2;
1066                 if (!locPeriod)
1067                     locPeriod = this._period = 0.3 * 1.5;
1068                 var s = locPeriod / 4;
1069                 dt = dt - 1;
1070                 if (dt < 0)
1071                     newT = -0.5 * Math.pow(2, 10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod);
1072                 else
1073                     newT = Math.pow(2, -10 * dt) * Math.sin((dt - s) * Math.PI * 2 / locPeriod) * 0.5 + 1;
1074             }
1075             return newT;
1076         },
1077         reverse: function(){
1078             return cc.easeElasticInOut(this._period);
1079         }
1080     };
1081 };
1082 
1083 /**
1084  * cc.EaseBounce abstract class.
1085  * @class
1086  * @extends cc.ActionEase
1087  */
1088 cc.EaseBounce = cc.ActionEase.extend(/** @lends cc.EaseBounce# */{
1089     /**
1090      * @param {Number} time1
1091      * @return {Number}
1092      */
1093     bounceTime:function (time1) {
1094         if (time1 < 1 / 2.75) {
1095             return 7.5625 * time1 * time1;
1096         } else if (time1 < 2 / 2.75) {
1097             time1 -= 1.5 / 2.75;
1098             return 7.5625 * time1 * time1 + 0.75;
1099         } else if (time1 < 2.5 / 2.75) {
1100             time1 -= 2.25 / 2.75;
1101             return 7.5625 * time1 * time1 + 0.9375;
1102         }
1103 
1104         time1 -= 2.625 / 2.75;
1105         return 7.5625 * time1 * time1 + 0.984375;
1106     },
1107 
1108     clone:function(){
1109         var action = new cc.EaseBounce();
1110         action.initWithAction(this._inner.clone());
1111         return action;
1112     },
1113 
1114     /**
1115      * @return {cc.EaseBounce}
1116      */
1117     reverse:function () {
1118         return cc.EaseBounce.create(this._inner.reverse());
1119     }
1120 });
1121 
1122 /** creates an ease bounce action
1123  * @static
1124  * @deprecated
1125  * @param {cc.ActionInterval} action
1126  * @return {cc.EaseBounce}
1127  */
1128 cc.EaseBounce.create = function (action) {
1129     return new cc.EaseBounce(action);
1130 };
1131 
1132 /**
1133  * cc.EaseBounceIn action.
1134  * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
1135  * @class
1136  * @extends cc.EaseBounce
1137  */
1138 cc.EaseBounceIn = cc.EaseBounce.extend(/** @lends cc.EaseBounceIn# */{
1139     /**
1140      * @param {Number} time1
1141      */
1142     update:function (time1) {
1143         var newT = 1 - this.bounceTime(1 - time1);
1144         this._inner.update(newT);
1145     },
1146 
1147     /**
1148      * @return {cc.EaseBounceOut}
1149      */
1150     reverse:function () {
1151         return cc.EaseBounceOut.create(this._inner.reverse());
1152     },
1153 
1154     clone:function(){
1155         var action = new cc.EaseBounceIn();
1156         action.initWithAction(this._inner.clone());
1157         return action;
1158     }
1159 });
1160 
1161 /** creates the action
1162  * @static
1163  * @deprecated
1164  * @param {cc.ActionInterval} action
1165  * @return {cc.EaseBounceIn}
1166  */
1167 cc.EaseBounceIn.create = function (action) {
1168     return new cc.EaseBounceIn(action);
1169 };
1170 
1171 cc._bounceTime = function (time1) {
1172     if (time1 < 1 / 2.75) {
1173         return 7.5625 * time1 * time1;
1174     } else if (time1 < 2 / 2.75) {
1175         time1 -= 1.5 / 2.75;
1176         return 7.5625 * time1 * time1 + 0.75;
1177     } else if (time1 < 2.5 / 2.75) {
1178         time1 -= 2.25 / 2.75;
1179         return 7.5625 * time1 * time1 + 0.9375;
1180     }
1181 
1182     time1 -= 2.625 / 2.75;
1183     return 7.5625 * time1 * time1 + 0.984375;
1184 };
1185 
1186 cc._easeBounceInObj = {
1187     easing: function(dt){
1188         return 1 - cc._bounceTime(1 - dt);
1189     },
1190     reverse: function(){
1191         return cc._easeBounceOutObj;
1192     }
1193 };
1194 /** creates the action easing object
1195  * @function
1196  * @return {Object}
1197  * @example
1198  * // example
1199  * action.easing(cc.easeBounceIn());
1200  */
1201 cc.easeBounceIn = function(){
1202     return cc._easeBounceInObj;
1203 };
1204 
1205 /**
1206  * cc.EaseBounceOut action.
1207  * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
1208  * @class
1209  * @extends cc.EaseBounce
1210  */
1211 cc.EaseBounceOut = cc.EaseBounce.extend(/** @lends cc.EaseBounceOut# */{
1212     /**
1213      * @param {Number} time1
1214      */
1215     update:function (time1) {
1216         var newT = this.bounceTime(time1);
1217         this._inner.update(newT);
1218     },
1219 
1220     /**
1221      * @return {cc.ActionInterval}
1222      */
1223     reverse:function () {
1224         return cc.EaseBounceIn.create(this._inner.reverse());
1225     },
1226 
1227     clone:function(){
1228         var action = new cc.EaseBounceOut();
1229         action.initWithAction(this._inner.clone());
1230         return action;
1231     }
1232 });
1233 
1234 /** creates the action
1235  * @static
1236  * @deprecated
1237  * @param {cc.ActionInterval} action
1238  * @return {cc.EaseBounceOut}
1239  */
1240 cc.EaseBounceOut.create = function (action) {
1241     return new cc.EaseBounceOut(action);
1242 };
1243 
1244 cc._easeBounceOutObj = {
1245     easing: function(dt){
1246         return cc._bounceTime(dt);
1247     },
1248     reverse:function () {
1249         return cc._easeBounceInObj;
1250     }
1251 };
1252 /**
1253  * Creates the action easing object
1254  * @function
1255  * @return {Object}
1256  * @example
1257  * // example
1258  * action.easing(cc.easeBounceOut());
1259  */
1260 cc.easeBounceOut = function(){
1261     return cc._easeBounceOutObj;
1262 };
1263 
1264 /**
1265  * cc.EaseBounceInOut action.
1266  * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
1267  * @class
1268  * @extends cc.EaseBounce
1269  */
1270 cc.EaseBounceInOut = cc.EaseBounce.extend(/** @lends cc.EaseBounceInOut# */{
1271     /**
1272      * @param {Number} time1
1273      */
1274     update:function (time1) {
1275         var newT = 0;
1276         if (time1 < 0.5) {
1277             time1 = time1 * 2;
1278             newT = (1 - this.bounceTime(1 - time1)) * 0.5;
1279         } else {
1280             newT = this.bounceTime(time1 * 2 - 1) * 0.5 + 0.5;
1281         }
1282         this._inner.update(newT);
1283     },
1284 
1285     clone:function(){
1286         var action = new cc.EaseBounceInOut();
1287         action.initWithAction(this._inner.clone());
1288         return action;
1289     },
1290 
1291     /**
1292      * @return {cc.EaseBounceInOut}
1293      */
1294     reverse:function () {
1295         return cc.EaseBounceInOut.create(this._inner.reverse());
1296     }
1297 });
1298 
1299 /** creates the action
1300  * @static
1301  * @deprecated
1302  * @param {cc.ActionInterval} action
1303  * @return {cc.EaseBounceInOut}
1304  */
1305 cc.EaseBounceInOut.create = function (action) {
1306     return new cc.EaseBounceInOut(action);
1307 };
1308 
1309 cc._easeBounceInOutObj = {
1310     easing: function (time1) {
1311         var newT;
1312         if (time1 < 0.5) {
1313             time1 = time1 * 2;
1314             newT = (1 - cc._bounceTime(1 - time1)) * 0.5;
1315         } else {
1316             newT = cc._bounceTime(time1 * 2 - 1) * 0.5 + 0.5;
1317         }
1318         return newT;
1319     },
1320     reverse: function(){
1321         return cc._easeBounceInOutObj;
1322     }
1323 };
1324 /**
1325  * Creates the action easing object
1326  * @function
1327  * @return {Object}
1328  * @example
1329  * // example
1330  * action.easing(cc.easeBounceInOut());
1331  */
1332 cc.easeBounceInOut = function(){
1333     return cc._easeBounceInOutObj;
1334 };
1335 
1336 /**
1337  * cc.EaseBackIn action.
1338  * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
1339  * @class
1340  * @extends cc.ActionEase
1341  */
1342 cc.EaseBackIn = cc.ActionEase.extend(/** @lends cc.EaseBackIn# */{
1343     /**
1344      * @param {Number} time1
1345      */
1346     update:function (time1) {
1347         var overshoot = 1.70158;
1348         time1 = time1===0 || time1==1 ? time1 : time1 * time1 * ((overshoot + 1) * time1 - overshoot);
1349         this._inner.update(time1);
1350     },
1351 
1352     /**
1353      * @return {cc.EaseBackOut}
1354      */
1355     reverse:function () {
1356         return cc.EaseBackOut.create(this._inner.reverse());
1357     },
1358 
1359     clone:function(){
1360         var action = new cc.EaseBackIn();
1361         action.initWithAction(this._inner.clone());
1362         return action;
1363     }
1364 });
1365 
1366 
1367 /** creates the action
1368  * @static
1369  * @deprecated
1370  * @param {cc.ActionInterval} action
1371  * @return {cc.EaseBackIn}
1372  */
1373 cc.EaseBackIn.create = function (action) {
1374     return new cc.EaseBackIn(action);
1375 };
1376 
1377 cc._easeBackInObj = {
1378     easing: function (time1) {
1379         var overshoot = 1.70158;
1380         return (time1===0 || time1===1) ? time1 : time1 * time1 * ((overshoot + 1) * time1 - overshoot);
1381     },
1382     reverse: function(){
1383         return cc._easeBackOutObj;
1384     }
1385 };
1386 /** creates the action easing object
1387  * @function
1388  * @return {Object}
1389  * @example
1390  * // example
1391  * action.easing(cc.easeBackIn());
1392  */
1393 cc.easeBackIn = function(){
1394     return cc._easeBackInObj;
1395 };
1396 
1397 /**
1398  * cc.EaseBackOut action.
1399  * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
1400  * @class
1401  * @extends cc.ActionEase
1402  */
1403 cc.EaseBackOut = cc.ActionEase.extend(/** @lends cc.EaseBackOut# */{
1404     /**
1405      * @param {Number} time1
1406      */
1407     update:function (time1) {
1408         var overshoot = 1.70158;
1409         time1 = time1 - 1;
1410         this._inner.update(time1 * time1 * ((overshoot + 1) * time1 + overshoot) + 1);
1411     },
1412 
1413     /**
1414      * @return {cc.EaseBackIn}
1415      */
1416     reverse:function () {
1417         return cc.EaseBackIn.create(this._inner.reverse());
1418     },
1419 
1420     clone:function(){
1421         var action = new cc.EaseBackOut();
1422         action.initWithAction(this._inner.clone());
1423         return action;
1424     }
1425 });
1426 
1427 /** creates the action
1428  * @static
1429  * @deprecated
1430  * @param {cc.ActionInterval} action
1431  * @return {cc.EaseBackOut}
1432  */
1433 cc.EaseBackOut.create = function (action) {
1434     return new cc.EaseBackOut(action);
1435 };
1436 
1437 cc._easeBackOutObj = {
1438     easing: function (time1) {
1439         var overshoot = 1.70158;
1440         time1 = time1 - 1;
1441         return time1 * time1 * ((overshoot + 1) * time1 + overshoot) + 1;
1442     },
1443     reverse: function(){
1444         return cc._easeBackInObj;
1445     }
1446 };
1447 /** creates the action easing object
1448  * @function
1449  * @return {Object}
1450  * @example
1451  * // example
1452  * action.easing(cc.easeBackOut());
1453  */
1454 cc.easeBackOut = function(){
1455     return cc._easeBackOutObj;
1456 };
1457 
1458 /**
1459  * cc.EaseBackInOut action.
1460  * @warning This action doesn't use a bijective function. Actions like Sequence might have an unexpected result when used with this action.
1461  * @class
1462  * @extends cc.ActionEase
1463  */
1464 cc.EaseBackInOut = cc.ActionEase.extend(/** @lends cc.EaseBackInOut# */{
1465     /**
1466      * @param {Number} time1
1467      */
1468     update:function (time1) {
1469         var overshoot = 1.70158 * 1.525;
1470         time1 = time1 * 2;
1471         if (time1 < 1) {
1472             this._inner.update((time1 * time1 * ((overshoot + 1) * time1 - overshoot)) / 2);
1473         } else {
1474             time1 = time1 - 2;
1475             this._inner.update((time1 * time1 * ((overshoot + 1) * time1 + overshoot)) / 2 + 1);
1476         }
1477     },
1478 
1479     clone:function(){
1480         var action = new cc.EaseBackInOut();
1481         action.initWithAction(this._inner.clone());
1482         return action;
1483     },
1484 
1485     /**
1486      * @return {cc.EaseBackInOut}
1487      */
1488     reverse:function () {
1489         return cc.EaseBackInOut.create(this._inner.reverse());
1490     }
1491 });
1492 
1493 
1494 /** creates the action
1495  * @static
1496  * @deprecated
1497  * @param {cc.ActionInterval} action
1498  * @return {cc.EaseBackInOut}
1499  */
1500 cc.EaseBackInOut.create = function (action) {
1501     return new cc.EaseBackInOut(action);
1502 };
1503 
1504 cc._easeBackInOutObj = {
1505     easing: function (time1) {
1506         var overshoot = 1.70158 * 1.525;
1507         time1 = time1 * 2;
1508         if (time1 < 1) {
1509             return (time1 * time1 * ((overshoot + 1) * time1 - overshoot)) / 2;
1510         } else {
1511             time1 = time1 - 2;
1512             return (time1 * time1 * ((overshoot + 1) * time1 + overshoot)) / 2 + 1;
1513         }
1514     },
1515     reverse: function(){
1516         return cc._easeBackInOutObj;
1517     }
1518 };
1519 /** creates the action easing object
1520  * @function
1521  * @return {Object}
1522  * @example
1523  * // example
1524  * action.easing(cc.easeBackInOut());
1525  */
1526 cc.easeBackInOut = function(){
1527     return cc._easeBackInOutObj;
1528 };
1529 
1530 /**
1531  * cc.EaseBezierAction action.
1532  * @type {Function|*}
1533  */
1534 cc.EaseBezierAction = cc.ActionEase.extend(/** @lends cc.EaseBezierAction# */{
1535 
1536     _p0: null,
1537     _p1: null,
1538     _p2: null,
1539     _p3: null,
1540 
1541     ctor: function(action){
1542         cc.ActionEase.prototype.ctor.call(this, action);
1543     },
1544 
1545     _updateTime: function(a, b, c, d, t){
1546         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 );
1547     },
1548 
1549     update: function(time){
1550         var t = this._updateTime(this._p0, this._p1, this._p2, this._p3, time);
1551         this._inner.update(t);
1552     },
1553     clone: function(){
1554         var action = new cc.EaseBezierAction();
1555         action.initWithAction(this._inner.clone());
1556         action.setBezierParamer(this._p0, this._p1, this._p2, this._p3);
1557         return action;
1558     },
1559     reverse: function(){
1560         var action = cc.EaseBezierAction.create(this._inner.reverse());
1561         action.setBezierParamer(this._p3, this._p2, this._p1, this._p0);
1562         return action;
1563     },
1564     setBezierParamer: function(p0, p1, p2, p3){
1565         this._p0 = p0 || 0;
1566         this._p1 = p1 || 0;
1567         this._p2 = p2 || 0;
1568         this._p3 = p3 || 0;
1569     }
1570 });
1571 
1572 /**
1573  * creates the action
1574  * @static
1575  * @deprecated
1576  * @param action
1577  * @returns {cc.EaseQuadraticActionIn}
1578  */
1579 cc.EaseBezierAction.create = function(action){
1580     return new cc.EaseBezierAction(action);
1581 };
1582 
1583 /**
1584  * creates the action easing object
1585  * @param {Number} p0 The first bezier parameter
1586  * @param {Number} p1 The second bezier parameter
1587  * @param {Number} p2 The third bezier parameter
1588  * @param {Number} p3 The fourth bezier parameter
1589  * @returns {Object}
1590  */
1591 cc.easeBezierAction = function(p0, p1, p2, p3){
1592     return {
1593         easing: function(time){
1594             return cc.EaseBezierAction.prototype._updateTime(p0, p1, p2, p3, time);
1595         },
1596         reverse: function(){
1597             return cc.easeBezierAction(p3, p2, p1, p0);
1598         }
1599     };
1600 };
1601 
1602 
1603 /**
1604  * cc.EaseQuadraticActionIn action.
1605  * @type {Function|*}
1606  */
1607 cc.EaseQuadraticActionIn = cc.ActionEase.extend(/** @lends cc.EaseQuadraticActionIn# */{
1608 
1609     _updateTime: function(time){
1610         return Math.pow(time, 2);
1611     },
1612 
1613     update: function(time){
1614         this._inner.update(this._updateTime(time));
1615     },
1616 
1617     clone: function(){
1618         var action = new cc.EaseQuadraticActionIn();
1619         action.initWithAction(this._inner.clone());
1620         return action;
1621     },
1622 
1623     reverse: function(){
1624         return cc.EaseQuadraticActionIn.create(this._inner.reverse());
1625     }
1626 
1627 });
1628 
1629 /**
1630  * creates the action
1631  * @static
1632  * @deprecated
1633  * @param action
1634  * @returns {cc.EaseQuadraticActionIn}
1635  */
1636 cc.EaseQuadraticActionIn.create = function(action){
1637     return new cc.EaseQuadraticActionIn(action);
1638 };
1639 
1640 cc._easeQuadraticActionIn = {
1641     easing: cc.EaseQuadraticActionIn.prototype._updateTime,
1642     reverse: function(){
1643         return cc._easeQuadraticActionIn;
1644     }
1645 };
1646 /**
1647  * creates the action easing object
1648  * @returns {Object}
1649  */
1650 cc.easeQuadraticActionIn = function(){
1651     return cc._easeQuadraticActionIn;
1652 };
1653 
1654 /**
1655  * cc.EaseQuadraticActionIn action.
1656  * @type {Function|*}
1657  */
1658 cc.EaseQuadraticActionOut = cc.ActionEase.extend(/** @lends cc.EaseQuadraticActionOut# */{
1659 
1660     _updateTime: function(time){
1661         return -time*(time-2);
1662     },
1663 
1664     update: function(time){
1665         this._inner.update(this._updateTime(time));
1666     },
1667     clone: function(){
1668         var action = new cc.EaseQuadraticActionOut();
1669         action.initWithAction();
1670         return action;
1671     },
1672     reverse: function(){
1673         return cc.EaseQuadraticActionOut.create(this._inner.reverse());
1674     }
1675 });
1676 
1677 /**
1678  * creates the action
1679  * @static
1680  * @deprecated
1681  * @param action
1682  * @returns {cc.EaseQuadraticActionOut}
1683  */
1684 cc.EaseQuadraticActionOut.create = function(action){
1685     return new cc.EaseQuadraticActionOut(action);
1686 };
1687 
1688 cc._easeQuadraticActionOut = {
1689     easing: cc.EaseQuadraticActionOut.prototype._updateTime,
1690     reverse: function(){
1691         return cc._easeQuadraticActionOut;
1692     }
1693 };
1694 /**
1695  * creates the action easing object
1696  * @function
1697  * @returns {Object}
1698  */
1699 cc.easeQuadraticActionOut = function(){
1700     return cc._easeQuadraticActionOut;
1701 };
1702 
1703 /**
1704  * cc.EaseQuadraticActionInOut action.
1705  * @type {Function|*}
1706  */
1707 cc.EaseQuadraticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuadraticActionInOut# */{
1708     _updateTime: function(time){
1709         var resultTime = time;
1710         time *= 2;
1711         if(time < 1){
1712             resultTime = time * time * 0.5;
1713         }else{
1714             --time;
1715             resultTime = -0.5 * ( time * ( time - 2 ) - 1)
1716         }
1717         return resultTime;
1718     },
1719     update: function(time){
1720         this._inner.update(this._updateTime(time));
1721     },
1722     clone: function(){
1723         var action = new cc.EaseQuadraticActionInOut();
1724         action.initWithAction(this._inner.clone());
1725         return action;
1726     },
1727     reverse: function(){
1728         return cc.EaseQuadraticActionInOut.create(this._inner.reverse());
1729     }
1730 });
1731 
1732 /**
1733  * creates the action
1734  * @static
1735  * @deprecated
1736  * @param action
1737  * @returns {cc.EaseQuadraticActionOut}
1738  */
1739 cc.EaseQuadraticActionInOut.create = function(action){
1740     return new cc.EaseQuadraticActionInOut(action);
1741 };
1742 
1743 cc._easeQuadraticActionInOut = {
1744     easing: cc.EaseQuadraticActionInOut.prototype._updateTime,
1745     reverse: function(){
1746         return cc._easeQuadraticActionInOut;
1747     }
1748 };
1749 /**
1750  * creates the action easing object
1751  * @function
1752  * @returns {Object}
1753  */
1754 cc.easeQuadraticActionInOut = function(){
1755     return cc._easeQuadraticActionInOut;
1756 };
1757 
1758 /**
1759  * cc.EaseQuarticActionIn action.
1760  * @type {Function|*}
1761  */
1762 cc.EaseQuarticActionIn = cc.ActionEase.extend(/** @lends cc.EaseQuarticActionIn# */{
1763     _updateTime: function(time){
1764         return time * time * time * time;
1765     },
1766     update: function(time){
1767         this._inner.update(this._updateTime(time));
1768     },
1769     clone: function(){
1770         var action = new cc.EaseQuarticActionIn();
1771         action.initWithAction(this._inner.clone());
1772         return action;
1773     },
1774     reverse: function(){
1775         return cc.EaseQuarticActionIn.create(this._inner.reverse());
1776     }
1777 });
1778 
1779 /**
1780  * creates the action
1781  * @static
1782  * @deprecated
1783  * @param action
1784  * @returns {cc.EaseQuadraticActionOut}
1785  */
1786 cc.EaseQuarticActionIn.create = function(action){
1787     return new cc.EaseQuarticActionIn(action);
1788 };
1789 
1790 cc._easeQuarticActionIn = {
1791     easing: cc.EaseQuarticActionIn.prototype._updateTime,
1792     reverse: function(){
1793         return cc._easeQuarticActionIn;
1794     }
1795 };
1796 /**
1797  * creates the action easing object
1798  * @function
1799  * @returns {Object}
1800  */
1801 cc.easeQuarticActionIn = function(){
1802     return cc._easeQuarticActionIn;
1803 };
1804 
1805 /**
1806  * cc.EaseQuarticActionOut action.
1807  * @type {Function|*}
1808  */
1809 cc.EaseQuarticActionOut = cc.ActionEase.extend(/** @lends cc.EaseQuarticActionOut# */{
1810     _updateTime: function(time){
1811         time -= 1;
1812         return -(time * time * time * time - 1);
1813     },
1814     update: function(time){
1815         this._inner.update(this._updateTime(time));
1816     },
1817     clone: function(){
1818         var action = new cc.EaseQuarticActionOut();
1819         action.initWithAction(this._inner.clone());
1820         return action;
1821     },
1822     reverse: function(){
1823         return cc.EaseQuarticActionOut.create(this._inner.reverse());
1824     }
1825 });
1826 
1827 /**
1828  * creates the action
1829  * @static
1830  * @deprecated
1831  * @param action
1832  * @returns {cc.EaseQuadraticActionOut}
1833  */
1834 cc.EaseQuarticActionOut.create = function(action){
1835     return new cc.EaseQuarticActionOut(action);
1836 };
1837 
1838 cc._easeQuarticActionOut = {
1839     easing: cc.EaseQuarticActionOut.prototype._updateTime,
1840     reverse: function(){
1841         return cc._easeQuarticActionOut;
1842     }
1843 };
1844 /**
1845  * creates the action easing object
1846  * @function
1847  * @returns {Object}
1848  */
1849 cc.easeQuarticActionOut = function(){
1850     return cc._easeQuarticActionOut;
1851 };
1852 
1853 /**
1854  * cc.EaseQuarticActionInOut action.
1855  * @type {Function|*}
1856  */
1857 cc.EaseQuarticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuarticActionInOut# */{
1858     _updateTime: function(time){
1859         time = time*2;
1860         if (time < 1)
1861             return 0.5 * time * time * time * time;
1862         time -= 2;
1863         return -0.5 * (time * time * time * time - 2);
1864     },
1865     update: function(time){
1866         this._inner.update(this._updateTime(time));
1867     },
1868     clone: function(){
1869         var action = new cc.EaseQuarticActionInOut();
1870         action.initWithAction(this._inner.clone());
1871         return action;
1872     },
1873     reverse: function(){
1874         return cc.EaseQuarticActionInOut.create(this._inner.reverse());
1875     }
1876 });
1877 
1878 /**
1879  * creates the action
1880  * @static
1881  * @deprecated
1882  * @param action
1883  * @returns {cc.EaseQuadraticActionOut}
1884  */
1885 cc.EaseQuarticActionInOut.create = function(action){
1886     return new cc.EaseQuarticActionInOut(action);
1887 };
1888 
1889 cc._easeQuarticActionInOut = {
1890     easing: cc.EaseQuarticActionInOut.prototype._updateTime,
1891     reverse: function(){
1892         return cc._easeQuarticActionInOut;
1893     }
1894 };
1895 /**
1896  * creates the action easing object
1897  * @function
1898  * @returns {Object}
1899  */
1900 cc.easeQuarticActionInOut = function(){
1901     return cc._easeQuarticActionInOut;
1902 };
1903 
1904 /**
1905  * cc.EaseQuinticActionIn action.
1906  * @type {Function|*}
1907  */
1908 cc.EaseQuinticActionIn = cc.ActionEase.extend(/** @lends cc.EaseQuinticActionIn# */{
1909     _updateTime: function(time){
1910         return time * time * time * time * time;
1911     },
1912     update: function(time){
1913         this._inner.update(this._updateTime(time));
1914     },
1915     clone: function(){
1916         var action = new cc.EaseQuinticActionIn();
1917         action.initWithAction(this._inner.clone());
1918         return action;
1919     },
1920     reverse: function(){
1921         return cc.EaseQuinticActionIn.create(this._inner.reverse());
1922     }
1923 });
1924 
1925 /**
1926  * creates the action
1927  * @static
1928  * @deprecated
1929  * @param action
1930  * @returns {cc.EaseQuadraticActionOut}
1931  */
1932 cc.EaseQuinticActionIn.create = function(action){
1933     return new cc.EaseQuinticActionIn(action);
1934 };
1935 
1936 cc._easeQuinticActionIn = {
1937     easing: cc.EaseQuinticActionIn.prototype._updateTime,
1938     reverse: function(){
1939         return cc._easeQuinticActionIn;
1940     }
1941 };
1942 /**
1943  * creates the action easing object
1944  * @function
1945  * @returns {Object}
1946  */
1947 cc.easeQuinticActionIn = function(){
1948     return cc._easeQuinticActionIn;
1949 };
1950 
1951 /**
1952  * cc.EaseQuinticActionOut action.
1953  * @type {Function|*}
1954  */
1955 cc.EaseQuinticActionOut = cc.ActionEase.extend(/** @lends cc.EaseQuinticActionOut# */{
1956     _updateTime: function(time){
1957         time -=1;
1958         return (time * time * time * time * time + 1);
1959     },
1960     update: function(time){
1961         this._inner.update(this._updateTime(time));
1962     },
1963     clone: function(){
1964         var action = new cc.EaseQuinticActionOut();
1965         action.initWithAction(this._inner.clone());
1966         return action;
1967     },
1968     reverse: function(){
1969         return cc.EaseQuinticActionOut.create(this._inner.reverse());
1970     }
1971 });
1972 
1973 /**
1974  * creates the action
1975  * @static
1976  * @deprecated
1977  * @param action
1978  * @returns {cc.EaseQuadraticActionOut}
1979  */
1980 cc.EaseQuinticActionOut.create = function(action){
1981     return new cc.EaseQuinticActionOut(action);
1982 };
1983 
1984 cc._easeQuinticActionOut = {
1985     easing: cc.EaseQuinticActionOut.prototype._updateTime,
1986     reverse: function(){
1987         return cc._easeQuinticActionOut;
1988     }
1989 };
1990 /**
1991  * creates the action easing object
1992  * @function
1993  * @returns {Object}
1994  */
1995 cc.easeQuinticActionOut = function(){
1996     return cc._easeQuinticActionOut;
1997 };
1998 
1999 /**
2000  * cc.EaseQuinticActionInOut action.
2001  * @type {Function|*}
2002  */
2003 cc.EaseQuinticActionInOut = cc.ActionEase.extend(/** @lends cc.EaseQuinticActionInOut# */{
2004     _updateTime: function(time){
2005         time = time*2;
2006         if (time < 1)
2007             return 0.5 * time * time * time * time * time;
2008         time -= 2;
2009         return 0.5 * (time * time * time * time * time + 2);
2010     },
2011     update: function(time){
2012         this._inner.update(this._updateTime(time));
2013     },
2014     clone: function(){
2015         var action = new cc.EaseQuinticActionInOut();
2016         action.initWithAction(this._inner.clone());
2017         return action;
2018     },
2019     reverse: function(){
2020         return cc.EaseQuinticActionInOut.create(this._inner.reverse());
2021     }
2022 });
2023 
2024 /**
2025  * creates the action
2026  * @static
2027  * @deprecated
2028  * @param action
2029  * @returns {cc.EaseQuadraticActionOut}
2030  */
2031 cc.EaseQuinticActionInOut.create = function(action){
2032     return new cc.EaseQuinticActionInOut(action);
2033 };
2034 
2035 cc._easeQuinticActionInOut = {
2036     easing: cc.EaseQuinticActionInOut.prototype._updateTime,
2037     reverse: function(){
2038         return cc._easeQuinticActionInOut;
2039     }
2040 };
2041 /**
2042  * creates the action easing object
2043  * @function
2044  * @returns {Object}
2045  */
2046 cc.easeQuinticActionInOut = function(){
2047     return cc._easeQuinticActionInOut;
2048 };
2049 
2050 /**
2051  * cc.EaseCircleActionIn action.
2052  * @type {Function|*}
2053  */
2054 cc.EaseCircleActionIn = cc.ActionEase.extend(/** @lends cc.EaseCircleActionIn# */{
2055     _updateTime: function(time){
2056         return -1 * (Math.sqrt(1 - time * time) - 1);
2057     },
2058     update: function(time){
2059         this._inner.update(this._updateTime(time));
2060     },
2061     clone: function(){
2062         var action = new cc.EaseCircleActionIn();
2063         action.initWithAction(this._inner.clone());
2064         return action;
2065     },
2066     reverse: function(){
2067         return cc.EaseCircleActionIn.create(this._inner.reverse());
2068     }
2069 });
2070 
2071 /**
2072  * creates the action
2073  * @static
2074  * @deprecated
2075  * @param action
2076  * @returns {cc.EaseQuadraticActionOut}
2077  */
2078 cc.EaseCircleActionIn.create = function(action){
2079     return new cc.EaseCircleActionIn(action);
2080 };
2081 
2082 cc._easeCircleActionIn = {
2083     easing: cc.EaseCircleActionIn.prototype._updateTime,
2084     reverse: function(){
2085         return cc._easeCircleActionIn;
2086     }
2087 };
2088 /**
2089  * creates the action easing object
2090  * @function
2091  * @returns {Object}
2092  */
2093 cc.easeCircleActionIn = function(){
2094     return cc._easeCircleActionIn;
2095 };
2096 
2097 /**
2098  * cc.EaseCircleActionOut action.
2099  * @type {Function|*}
2100  */
2101 cc.EaseCircleActionOut = cc.ActionEase.extend(/** @lends cc.EaseCircleActionOut# */{
2102     _updateTime: function(time){
2103         time = time - 1;
2104         return Math.sqrt(1 - time * time);
2105     },
2106     update: function(time){
2107         this._inner.update(this._updateTime(time));
2108     },
2109     clone: function(){
2110         var action = new cc.EaseCircleActionOut();
2111         action.initWithAction(this._inner.clone());
2112         return action;
2113     },
2114     reverse: function(){
2115         return cc.EaseCircleActionOut.create(this._inner.reverse());
2116     }
2117 });
2118 
2119 /**
2120  * creates the action
2121  * @static
2122  * @deprecated
2123  * @param action
2124  * @returns {cc.EaseQuadraticActionOut}
2125  */
2126 cc.EaseCircleActionOut.create = function(action){
2127     return new cc.EaseCircleActionOut(action);
2128 };
2129 
2130 cc._easeCircleActionOut = {
2131     easing: cc.EaseCircleActionOut.prototype._updateTime,
2132     reverse: function(){
2133         return cc._easeCircleActionOut;
2134     }
2135 };
2136 /**
2137  * creates the action easing object
2138  * @function
2139  * @returns {Object}
2140  */
2141 cc.easeCircleActionOut = function(){
2142     return cc._easeCircleActionOut;
2143 };
2144 
2145 /**
2146  * cc.EaseCircleActionInOut action.
2147  * @type {Function|*}
2148  */
2149 cc.EaseCircleActionInOut = cc.ActionEase.extend(/** @lends cc.EaseCircleActionInOut# */{
2150     _updateTime: function(time){
2151         time = time * 2;
2152         if (time < 1)
2153             return -0.5 * (Math.sqrt(1 - time * time) - 1);
2154         time -= 2;
2155         return 0.5 * (Math.sqrt(1 - time * time) + 1);
2156     },
2157     update: function(time){
2158         this._inner.update(this._updateTime(time));
2159     },
2160     clone: function(){
2161         var action = new cc.EaseCircleActionInOut();
2162         action.initWithAction(this._inner.clone());
2163         return action;
2164     },
2165     reverse: function(){
2166         return cc.EaseCircleActionInOut.create(this._inner.reverse());
2167     }
2168 });
2169 
2170 /**
2171  * creates the action
2172  * @static
2173  * @deprecated
2174  * @param action
2175  * @returns {cc.EaseQuadraticActionOut}
2176  */
2177 cc.EaseCircleActionInOut.create = function(action){
2178     return new cc.EaseCircleActionInOut(action);
2179 };
2180 
2181 cc._easeCircleActionInOut = {
2182     easing: cc.EaseCircleActionInOut.prototype._updateTime,
2183     reverse: function(){
2184         return cc._easeCircleActionInOut;
2185     }
2186 };
2187 /**
2188  * creates the action easing object
2189  * @function
2190  * @returns {Object}
2191  */
2192 cc.easeCircleActionInOut = function(){
2193     return cc._easeCircleActionInOut;
2194 };
2195 
2196 /**
2197  * cc.EaseCubicActionIn action.
2198  * @type {Function|*}
2199  */
2200 cc.EaseCubicActionIn = cc.ActionEase.extend(/** @lends cc.EaseCubicActionIn# */{
2201     _updateTime: function(time){
2202         return time * time * time;
2203     },
2204     update: function(time){
2205         this._inner.update(this._updateTime(time));
2206     },
2207     clone: function(){
2208         var action = new cc.EaseCubicActionIn();
2209         action.initWithAction(this._inner.clone());
2210         return action;
2211     },
2212     reverse: function(){
2213         return cc.EaseCubicActionIn.create(this._inner.reverse());
2214     }
2215 });
2216 
2217 /**
2218  * creates the action
2219  * @static
2220  * @deprecated
2221  * @param action
2222  * @returns {cc.EaseQuadraticActionOut}
2223  */
2224 cc.EaseCubicActionIn.create = function(action){
2225     return new cc.EaseCubicActionIn(action);
2226 };
2227 
2228 cc._easeCubicActionIn = {
2229     easing: cc.EaseCubicActionIn.prototype._updateTime,
2230     reverse: function(){
2231         return cc._easeCubicActionIn;
2232     }
2233 };
2234 /**
2235  * creates the action easing object
2236  * @function
2237  * @returns {Object}
2238  */
2239 cc.easeCubicActionIn = function(){
2240     return cc._easeCubicActionIn;
2241 };
2242 
2243 /**
2244  * cc.EaseCubicActionOut action.
2245  * @type {Function|*}
2246  */
2247 cc.EaseCubicActionOut = cc.ActionEase.extend(/** @lends cc.EaseCubicActionOut# */{
2248     _updateTime: function(time){
2249         time -= 1;
2250         return (time * time * time + 1);
2251     },
2252     update: function(time){
2253         this._inner.update(this._updateTime(time));
2254     },
2255     clone: function(){
2256         var action = new cc.EaseCubicActionOut();
2257         action.initWithAction(this._inner.clone());
2258         return action;
2259     },
2260     reverse: function(){
2261         return cc.EaseCubicActionOut.create(this._inner.reverse());
2262     }
2263 });
2264 
2265 /**
2266  * creates the action
2267  * @static
2268  * @deprecated
2269  * @param action
2270  * @returns {cc.EaseQuadraticActionOut}
2271  */
2272 cc.EaseCubicActionOut.create = function(action){
2273     return new cc.EaseCubicActionOut(action);
2274 };
2275 
2276 cc._easeCubicActionOut = {
2277     easing: cc.EaseCubicActionOut.prototype._updateTime,
2278     reverse: function(){
2279         return cc._easeCubicActionOut;
2280     }
2281 };
2282 /**
2283  * creates the action easing object
2284  * @function
2285  * @returns {Object}
2286  */
2287 cc.easeCubicActionOut = function(){
2288     return cc._easeCubicActionOut;
2289 };
2290 
2291 
2292 /**
2293  * cc.EaseCubicActionInOut action.
2294  * @type {Function|*}
2295  */
2296 cc.EaseCubicActionInOut = cc.ActionEase.extend(/** @lends cc.EaseCubicActionInOut# */{
2297     _updateTime: function(time){
2298         time = time*2;
2299         if (time < 1)
2300             return 0.5 * time * time * time;
2301         time -= 2;
2302         return 0.5 * (time * time * time + 2);
2303     },
2304     update: function(time){
2305         this._inner.update(this._updateTime(time));
2306     },
2307     clone: function(){
2308         var action = new cc.EaseCubicActionInOut();
2309         action.initWithAction(this._inner.clone());
2310         return action;
2311     },
2312     reverse: function(){
2313         return cc.EaseCubicActionInOut.create(this._inner.reverse());
2314     }
2315 });
2316 
2317 /**
2318  * creates the action
2319  * @static
2320  * @deprecated
2321  * @param action
2322  * @returns {cc.EaseQuadraticActionOut}
2323  */
2324 cc.EaseCubicActionInOut.create = function(action){
2325     return new cc.EaseCubicActionInOut(action);
2326 };
2327 
2328 cc._easeCubicActionInOut = {
2329     easing: cc.EaseCubicActionInOut.prototype._updateTime,
2330     reverse: function(){
2331         return cc._easeCubicActionInOut;
2332     }
2333 };
2334 /**
2335  * creates the action easing object
2336  * @function
2337  * @returns {Object}
2338  */
2339 cc.easeCubicActionInOut = function(){
2340     return cc._easeCubicActionInOut;
2341 };
2342 
2343