An Elastic easing used for ElasticInOut functions.
| 312 | * An Elastic easing used for ElasticInOut functions. |
| 313 | */ |
| 314 | class ElasticInOut extends Elastic { |
| 315 | public ElasticInOut(float amplitude, float period) { |
| 316 | super(amplitude, period); |
| 317 | } |
| 318 | |
| 319 | public ElasticInOut() { |
| 320 | super(); |
| 321 | } |
| 322 | |
| 323 | public float ease(float t, float b, float c, float d) { |
| 324 | float a = getAmplitude(); |
| 325 | float p = getPeriod(); |
| 326 | if (t == 0) return b; |
| 327 | if ((t /= d / 2) == 2) return b + c; |
| 328 | if (p == 0) p = d * (.3f * 1.5f); |
| 329 | float s = 0; |
| 330 | if (a < Math.abs(c)) { |
| 331 | a = c; |
| 332 | s = p / 4f; |
| 333 | } else s = p / (float) (2 * Math.PI) * (float) Math.asin(c / a); |
| 334 | if (t < 1) |
| 335 | return -.5f * (a * (float) Math.pow(2, 10 * (t -= 1)) * (float) Math.sin((t * d - s) * (2 * Math.PI) / p)) + b; |
| 336 | return a * (float) Math.pow(2, -10 * (t -= 1)) * (float) Math.sin((t * d - s) * (2 * Math.PI) / p) * .5f + c + b; |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | /** |
| 341 | * A base class for Back easings. |
nothing calls this directly
no outgoing calls
no test coverage detected