@@ -237,7 +237,11 @@ cc.easeIn = function (rate) {
237237 _rate : rate ,
238238 easing : function ( dt ) {
239239 return Math . pow ( dt , this . _rate ) ;
240- } } ;
240+ } ,
241+ reverse : function ( ) {
242+ return cc . easeIn ( 1 / this . _rate ) ;
243+ }
244+ } ;
241245} ;
242246
243247/**
@@ -284,7 +288,11 @@ cc.easeOut = function (rate) {
284288 _rate : rate ,
285289 easing : function ( dt ) {
286290 return Math . pow ( dt , 1 / this . _rate ) ;
287- } } ;
291+ } ,
292+ reverse : function ( ) {
293+ return cc . easeOut ( 1 / this . _rate )
294+ }
295+ } ;
288296} ;
289297
290298/**
@@ -339,7 +347,11 @@ cc.easeInOut = function (rate) {
339347 return 0.5 * Math . pow ( dt , this . _rate ) ;
340348 else
341349 return 1.0 - 0.5 * Math . pow ( 2 - dt , this . _rate ) ;
342- } } ;
350+ } ,
351+ reverse : function ( ) {
352+ return cc . easeInOut ( this . _rate ) ;
353+ }
354+ } ;
343355} ;
344356
345357/**
@@ -383,6 +395,9 @@ cc.EaseExponentialIn.create = function (action) {
383395cc . _easeExponentialInObj = {
384396 easing : function ( dt ) {
385397 return dt === 0 ? 0 : Math . pow ( 2 , 10 * ( dt - 1 ) ) ;
398+ } ,
399+ reverse : function ( ) {
400+ return cc . _easeExponentialOutObj ;
386401 }
387402} ;
388403cc . easeExponentialIn = function ( ) {
@@ -430,6 +445,9 @@ cc.EaseExponentialOut.create = function (action) {
430445cc . _easeExponentialOutObj = {
431446 easing : function ( dt ) {
432447 return dt == 1 ? 1 : ( - ( Math . pow ( 2 , - 10 * dt ) ) + 1 ) ;
448+ } ,
449+ reverse : function ( ) {
450+ return cc . _easeExponentialInObj ;
433451 }
434452} ;
435453cc . easeExponentialOut = function ( ) {
@@ -491,6 +509,9 @@ cc._easeExponentialInOutObj = {
491509 return 0.5 * ( - Math . pow ( 2 , - 10 * ( dt - 1 ) ) + 2 ) ;
492510 }
493511 return dt ;
512+ } ,
513+ reverse : function ( ) {
514+ return cc . _easeExponentialInOutObj ;
494515 }
495516} ;
496517cc . easeExponentialInOut = function ( ) {
@@ -539,6 +560,9 @@ cc.EaseSineIn.create = function (action) {
539560cc . _easeSineInObj = {
540561 easing : function ( dt ) {
541562 return ( dt === 0 || dt === 1 ) ? dt : - 1 * Math . cos ( dt * Math . PI / 2 ) + 1 ;
563+ } ,
564+ reverse : function ( ) {
565+ return cc . _easeSineOutObj ;
542566 }
543567} ;
544568cc . easeSineIn = function ( ) {
@@ -587,6 +611,9 @@ cc.EaseSineOut.create = function (action) {
587611cc . _easeSineOutObj = {
588612 easing : function ( dt ) {
589613 return ( dt === 0 || dt == 1 ) ? dt : Math . sin ( dt * Math . PI / 2 ) ;
614+ } ,
615+ reverse : function ( ) {
616+ return cc . _easeSineInObj ;
590617 }
591618} ;
592619cc . easeSineOut = function ( ) {
@@ -635,6 +662,9 @@ cc.EaseSineInOut.create = function (action) {
635662cc . _easeSineInOutObj = {
636663 easing : function ( dt ) {
637664 return ( dt === 0 || dt === 1 ) ? dt : - 0.5 * ( Math . cos ( Math . PI * dt ) - 1 ) ;
665+ } ,
666+ reverse : function ( ) {
667+ return cc . _easeSineInOutObj ;
638668 }
639669} ;
640670cc . easeSineInOut = function ( ) {
@@ -772,7 +802,10 @@ cc._easeElasticInObj = {
772802 return dt ;
773803 dt = dt - 1 ;
774804 return - Math . pow ( 2 , 10 * dt ) * Math . sin ( ( dt - ( 0.3 / 4 ) ) * Math . PI * 2 / 0.3 ) ;
775- }
805+ } ,
806+ reverse :function ( ) {
807+ return cc . _easeElasticOutObj ;
808+ }
776809} ;
777810
778811cc . easeElasticIn = function ( period ) {
@@ -784,7 +817,14 @@ cc.easeElasticIn = function (period) {
784817 return dt ;
785818 dt = dt - 1 ;
786819 return - Math . pow ( 2 , 10 * dt ) * Math . sin ( ( dt - ( this . _period / 4 ) ) * Math . PI * 2 / this . _period ) ;
787- } } ;
820+ } ,
821+ /**
822+ * @return {cc.EaseElasticIn }
823+ */
824+ reverse :function ( ) {
825+ return cc . easeElasticOut ( this . _period ) ;
826+ }
827+ } ;
788828 }
789829 return cc . _easeElasticInObj ;
790830} ;
@@ -841,6 +881,9 @@ cc.EaseElasticOut.create = function (action, period) {
841881cc . _easeElasticOutObj = {
842882 easing : function ( dt ) {
843883 return ( dt === 0 || dt === 1 ) ? dt : Math . pow ( 2 , - 10 * dt ) * Math . sin ( ( dt - ( 0.3 / 4 ) ) * Math . PI * 2 / 0.3 ) + 1 ;
884+ } ,
885+ reverse :function ( ) {
886+ return cc . _easeElasticInObj ;
844887 }
845888} ;
846889
@@ -850,7 +893,11 @@ cc.easeElasticOut = function (period) {
850893 _period : period ,
851894 easing : function ( dt ) {
852895 return ( dt === 0 || dt === 1 ) ? dt : Math . pow ( 2 , - 10 * dt ) * Math . sin ( ( dt - ( this . _period / 4 ) ) * Math . PI * 2 / this . _period ) + 1 ;
853- } } ;
896+ } ,
897+ reverse :function ( ) {
898+ return cc . easeElasticIn ( this . _period ) ;
899+ }
900+ } ;
854901 }
855902 return cc . _easeElasticOutObj ;
856903} ;
@@ -932,7 +979,11 @@ cc.easeElasticInOut = function (period) {
932979 newT = Math . pow ( 2 , - 10 * dt ) * Math . sin ( ( dt - s ) * Math . PI * 2 / locPeriod ) * 0.5 + 1 ;
933980 }
934981 return newT ;
935- } } ;
982+ } ,
983+ reverse : function ( ) {
984+ return cc . EaseElasticInOut ( this . _period ) ;
985+ }
986+ } ;
936987} ;
937988
938989/**
@@ -1043,6 +1094,9 @@ cc._bounceTime = function (time1) {
10431094cc . _easeBounceInObj = {
10441095 easing : function ( dt ) {
10451096 return 1 - cc . _bounceTime ( 1 - dt ) ;
1097+ } ,
1098+ reverse : function ( ) {
1099+ return cc . _easeBounceOutObj ;
10461100 }
10471101} ;
10481102cc . easeBounceIn = function ( ) {
@@ -1092,6 +1146,9 @@ cc.EaseBounceOut.create = function (action) {
10921146cc . _easeBounceOutObj = {
10931147 easing : function ( dt ) {
10941148 return cc . _bounceTime ( dt ) ;
1149+ } ,
1150+ reverse :function ( ) {
1151+ return cc . _easeBounceInObj ;
10951152 }
10961153} ;
10971154cc . easeBounceOut = function ( ) {
@@ -1154,7 +1211,11 @@ cc._easeBounceInOutObj = {
11541211 newT = cc . _bounceTime ( time1 * 2 - 1 ) * 0.5 + 0.5 ;
11551212 }
11561213 return newT ;
1157- } } ;
1214+ } ,
1215+ reverse : function ( ) {
1216+ return cc . _easeBounceInOutObj ;
1217+ }
1218+ } ;
11581219
11591220cc . easeBounceInOut = function ( ) {
11601221 return cc . _easeBounceInOutObj ;
@@ -1206,7 +1267,11 @@ cc._easeBackInObj = {
12061267 easing : function ( time1 ) {
12071268 var overshoot = 1.70158 ;
12081269 return ( time1 === 0 || time1 === 1 ) ? time1 : time1 * time1 * ( ( overshoot + 1 ) * time1 - overshoot ) ;
1209- } } ;
1270+ } ,
1271+ reverse : function ( ) {
1272+ return cc . _easeBackOutObj ;
1273+ }
1274+ } ;
12101275
12111276cc . easeBackIn = function ( ) {
12121277 return cc . _easeBackInObj ;
@@ -1258,7 +1323,11 @@ cc._easeBackOutObj = {
12581323 var overshoot = 1.70158 ;
12591324 time1 = time1 - 1 ;
12601325 return time1 * time1 * ( ( overshoot + 1 ) * time1 + overshoot ) + 1 ;
1261- } } ;
1326+ } ,
1327+ reverse : function ( ) {
1328+ return cc . _easeBackInObj ;
1329+ }
1330+ } ;
12621331
12631332cc . easeBackOut = function ( ) {
12641333 return cc . _easeBackOutObj ;
@@ -1321,7 +1390,11 @@ cc._easeBackInOutObj = {
13211390 time1 = time1 - 2 ;
13221391 return ( time1 * time1 * ( ( overshoot + 1 ) * time1 + overshoot ) ) / 2 + 1 ;
13231392 }
1324- } } ;
1393+ } ,
1394+ reverse : function ( ) {
1395+ return cc . _easeBackInOutObj ;
1396+ }
1397+ } ;
13251398
13261399cc . easeBackInOut = function ( ) {
13271400 return cc . _easeBackInOutObj ;
0 commit comments