@@ -139,6 +139,34 @@ exports.inOutBounce = function(n){
139
139
return exports . outBounce ( n * 2 - 1 ) * .5 + .5 ;
140
140
} ;
141
141
142
+ exports . inElastic = function ( n ) {
143
+ var s , a = 0.1 , p = 0.4 ;
144
+ if ( n === 0 ) return 0 ;
145
+ if ( n === 1 ) return 1 ;
146
+ if ( ! a || a < 1 ) { a = 1 ; s = p / 4 ; }
147
+ else s = p * Math . asin ( 1 / a ) / ( 2 * Math . PI ) ;
148
+ return - ( a * Math . pow ( 2 , 10 * ( n -= 1 ) ) * Math . sin ( ( n - s ) * ( 2 * Math . PI ) / p ) ) ;
149
+ } ;
150
+
151
+ exports . outElastic = function ( n ) {
152
+ var s , a = 0.1 , p = 0.4 ;
153
+ if ( n === 0 ) return 0 ;
154
+ if ( n === 1 ) return 1 ;
155
+ if ( ! a || a < 1 ) { a = 1 ; s = p / 4 ; }
156
+ else s = p * Math . asin ( 1 / a ) / ( 2 * Math . PI ) ;
157
+ return ( a * Math . pow ( 2 , - 10 * n ) * Math . sin ( ( n - s ) * ( 2 * Math . PI ) / p ) + 1 ) ;
158
+ } ;
159
+
160
+ exports . inOutElastic = function ( n ) {
161
+ var s , a = 0.1 , p = 0.4 ;
162
+ if ( n === 0 ) return 0 ;
163
+ if ( n === 1 ) return 1 ;
164
+ if ( ! a || a < 1 ) { a = 1 ; s = p / 4 ; }
165
+ else s = p * Math . asin ( 1 / a ) / ( 2 * Math . PI ) ;
166
+ if ( ( n *= 2 ) < 1 ) return - 0.5 * ( a * Math . pow ( 2 , 10 * ( n -= 1 ) ) * Math . sin ( ( n - s ) * ( 2 * Math . PI ) / p ) ) ;
167
+ return a * Math . pow ( 2 , - 10 * ( n -= 1 ) ) * Math . sin ( ( n - s ) * ( 2 * Math . PI ) / p ) * 0.5 + 1 ;
168
+ } ;
169
+
142
170
// aliases
143
171
144
172
exports [ 'in-quad' ] = exports . inQuad ;
@@ -168,3 +196,6 @@ exports['in-out-back'] = exports.inOutBack;
168
196
exports [ 'in-bounce' ] = exports . inBounce ;
169
197
exports [ 'out-bounce' ] = exports . outBounce ;
170
198
exports [ 'in-out-bounce' ] = exports . inOutBounce ;
199
+ exports [ 'in-elastic' ] = exports . inElastic ;
200
+ exports [ 'out-elastic' ] = exports . outElastic ;
201
+ exports [ 'in-out-elastic' ] = exports . inOutElastic ;
0 commit comments