1 package aurelienribon.tweenengine.equations;
2 
3 import aurelienribon.tweenengine.TweenEquation;
4 
5 /**
6  * Easing equation based on Robert Penner's work:
7  * http://robertpenner.com/easing/
8  * @author Aurelien Ribon | http://www.aurelienribon.com/
9  */
10 public abstract class Expo extends TweenEquation {
11 	public static final Expo IN = new Expo() {
12 		@Override
13 		public final float compute(float t) {
14 			return (t==0) ? 0 : (float) Math.pow(2, 10 * (t - 1));
15 		}
16 
17 		@Override
18 		public String toString() {
19 			return "Expo.IN";
20 		}
21 	};
22 
23 	public static final Expo OUT = new Expo() {
24 		@Override
25 		public final float compute(float t) {
26 			return (t==1) ? 1 : -(float) Math.pow(2, -10 * t) + 1;
27 		}
28 
29 		@Override
30 		public String toString() {
31 			return "Expo.OUT";
32 		}
33 	};
34 
35 	public static final Expo INOUT = new Expo() {
36 		@Override
37 		public final float compute(float t) {
38 			if (t==0) return 0;
39 			if (t==1) return 1;
40 			if ((t*=2) < 1) return 0.5f * (float) Math.pow(2, 10 * (t - 1));
41 			return 0.5f * (-(float)Math.pow(2, -10 * --t) + 2);
42 		}
43 
44 		@Override
45 		public String toString() {
46 			return "Expo.INOUT";
47 		}
48 	};
49 }