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