An Elastic easing used for ElasticIn functions.
| 258 | * An Elastic easing used for ElasticIn functions. |
| 259 | */ |
| 260 | class ElasticIn extends Elastic { |
| 261 | public ElasticIn(float amplitude, float period) { |
| 262 | super(amplitude, period); |
| 263 | } |
| 264 | |
| 265 | public ElasticIn() { |
| 266 | super(); |
| 267 | } |
| 268 | |
| 269 | public float ease(float t, float b, float c, float d) { |
| 270 | float a = getAmplitude(); |
| 271 | float p = getPeriod(); |
| 272 | if (t == 0) return b; |
| 273 | if ((t /= d) == 1) return b + c; |
| 274 | if (p == 0) p = d * .3f; |
| 275 | float s = 0; |
| 276 | if (a < Math.abs(c)) { |
| 277 | a = c; |
| 278 | s = p / 4; |
| 279 | } else s = p / (float) (2 * Math.PI) * (float) Math.asin(c / a); |
| 280 | return -(a * (float) Math.pow(2, 10 * (t -= 1)) * (float) Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | /** |
| 285 | * An Elastic easing used for ElasticOut functions. |
nothing calls this directly
no outgoing calls
no test coverage detected