4 static float EaseInSine(
float t )
6 return -1 *
Math.Cos( t * (
Math.PI / 2 ) ) + 1;
9 static float EaseOutSine(
float t )
11 return Math.Sin( t * (
Math.PI / 2 ) );
14 static float EaseInOutSine(
float t )
16 return -0.5 * (
Math.Cos(
Math.PI * t ) - 1 );
19 static float EaseInQuad(
float t )
24 static float EaseOutQuad(
float t )
29 static float EaseInOutQuad(
float t )
34 return -1 + ( 4 - 2 * t ) * t;
37 static float EaseInCubic(
float t )
42 static float EaseOutCubic(
float t )
45 return t1 * t1 * t1 + 1;
48 static float EaseInOutCubic(
float t )
53 return ( t - 1 ) * ( 2 * t - 2 ) * ( 2 * t - 2 ) + 1;
56 static float EaseInQuart(
float t )
61 static float EaseOutQuart(
float t )
64 return 1 - t1 * t1 * t1 * t1;
68 static float EaseInOutQuart(
float t )
73 return 8 * t * t * t * t;
75 return 1 - 8 * t1 * t1 * t1 * t1;
78 static float EaseInQuint(
float t )
80 return t * t * t * t * t;
83 static float EaseOutQuint(
float t )
86 return 1 + t1 * t1 * t1 * t1 * t1;
89 static float EaseInOutQuint(
float t )
95 return 16 * t * t * t * t * t;
99 return 1 + 16 * t1 * t1 * t1 * t1 * t1;
103 static float EaseInExpo(
float t )
110 return Math.Pow( 2, 10 * ( t - 1 ) );
113 static float EaseOutExpo(
float t )
119 return ( -
Math.Pow( 2, -10 * t ) + 1 );
122 static float EaseInOutExpo(
float t )
125 if( t == 0 || t == 1 )
130 float scaledTime = t * 2;
131 float scaledTime1 = scaledTime - 1;
135 return 0.5 *
Math.Pow( 2, 10 * scaledTime1 );
138 return 0.5 * ( -
Math.Pow( 2, -10 * scaledTime1 ) + 2 );
142 static float EaseInCirc(
float t )
144 float scaledTime = t / 1;
145 return -1 * (
Math.Sqrt( 1 - scaledTime * t ) - 1 );
148 static float EaseOutCirc(
float t )
151 return Math.Sqrt( 1 - t1 * t1 );
154 static float EaseInOutCirc(
float t )
157 float scaledTime = t * 2;
158 float scaledTime1 = scaledTime - 2;
162 return -0.5 * (
Math.Sqrt( 1 - scaledTime * scaledTime ) - 1 );
165 return 0.5 * (
Math.Sqrt( 1 - scaledTime1 * scaledTime1 ) + 1 );
168 static float EaseInBack(
float t,
float magnitude = 1.70158 )
170 return t * t * ( ( magnitude + 1 ) * t - magnitude );
173 static float EaseOutBack(
float t,
float magnitude = 1.70158 )
175 float scaledTime = ( t / 1 ) - 1;
176 return (scaledTime * scaledTime * ( ( magnitude + 1 ) * scaledTime + magnitude )) + 1;
179 static float EaseInOutBack(
float t,
float magnitude = 1.70158 )
182 float scaledTime = t * 2;
183 float scaledTime2 = scaledTime - 2;
185 float s = magnitude * 1.525;
189 return 0.5 * scaledTime * scaledTime * (( ( s + 1 ) * scaledTime ) - s);
192 return 0.5 * (scaledTime2 * scaledTime2 * ( ( s + 1 ) * scaledTime2 + s ) + 2);
195 static float EaseInElastic(
float t,
float magnitude = 0.7 )
197 if( t == 0 || t == 1 )
200 float scaledTime = t / 1;
201 float scaledTime1 = scaledTime - 1;
203 float p = 1 - magnitude;
204 float s = p / ( 2 *
Math.PI ) *
Math.Asin( 1 );
206 return -(
Math.Pow( 2, 10 * scaledTime1 ) *
Math.Sin( ( scaledTime1 - s ) * ( 2 *
Math.PI ) / p ));
209 static float EaseOutElastic(
float t,
float magnitude = 0.7 )
211 float p = 1 - magnitude;
212 float scaledTime = t * 2;
214 if( t == 0 || t == 1 ) {
218 float s = p / ( 2 *
Math.PI ) *
Math.Asin( 1 );
219 return (
Math.Pow( 2, -10 * scaledTime ) *
Math.Sin( ( scaledTime - s ) * ( 2 *
Math.PI ) / p )) + 1;
222 static float EaseInOutElastic(
float t,
float magnitude = 0.65 )
224 float p = 1 - magnitude;
226 if( t == 0 || t == 1 )
231 float scaledTime = t * 2;
232 float scaledTime1 = scaledTime - 1;
234 float s = p / ( 2 *
Math.PI ) *
Math.Asin( 1 );
238 return -0.5 * (
Math.Pow( 2, 10 * scaledTime1 ) *
Math.Sin( ( scaledTime1 - s ) * ( 2 *
Math.PI ) / p ));
241 return (
Math.Pow( 2, -10 * scaledTime1 ) *
Math.Sin( ( scaledTime1 - s ) * ( 2 *
Math.PI ) / p ) * 0.5) + 1;
244 static float EaseOutBounce(
float t )
247 float scaledTime = t / 1;
249 if( scaledTime < ( 1 / 2.75 ) ) {
251 return 7.5625 * scaledTime * scaledTime;
253 }
else if( scaledTime < ( 2 / 2.75 ) ) {
255 float scaledTime2 = scaledTime - ( 1.5 / 2.75 );
256 return ( 7.5625 * scaledTime2 * scaledTime2 ) + 0.75;
258 }
else if( scaledTime < ( 2.5 / 2.75 ) ) {
260 scaledTime2 = scaledTime - ( 2.25 / 2.75 );
261 return ( 7.5625 * scaledTime2 * scaledTime2 ) + 0.9375;
265 scaledTime2 = scaledTime - ( 2.625 / 2.75 );
266 return ( 7.5625 * scaledTime2 * scaledTime2 ) + 0.984375;
271 static float EaseInBounce(
float t )
273 return 1 - EaseOutBounce( 1 - t );
276 static float EaseInOutBounce(
float t )
280 return EaseInBounce( t * 2 ) * 0.5;
282 return ( EaseOutBounce( ( t * 2 ) - 1 ) * 0.5 ) + 0.5;