/**\r
* Easing method to use.\r
*/\r
- public enum Easing {\r
- LINEAR, SWING\r
+ public static interface Easing {\r
+ public double interpolate(double progress);\r
+ \r
+ public Easing LINEAR = new Easing() { \r
+ public double interpolate(double progress) {\r
+ return progress;\r
+ }\r
+ };\r
+ \r
+ public Easing SWING = new Easing() { \r
+ public double interpolate(double progress) {\r
+ return (1 + Math.cos(Math.PI + progress * Math.PI)) / 2;\r
+ }\r
+ };\r
}\r
\r
/**\r
\r
@Override\r
protected double interpolate(double progress) {\r
- if (easing == Easing.SWING) {\r
- return super.interpolate(progress);\r
- } else {\r
- return progress;\r
+ if (easing != null){\r
+ return easing.interpolate(progress);\r
}\r
+ //maybe return super.interpolate() instead ?\r
+ return progress;\r
}\r
\r
}\r