MCPcopy Create free account
hub / github.com/LaVache-FR/AnimationUtil / ElasticOut

Class ElasticOut

fr/lavache/anime/Easing.java:287–309  ·  view source on GitHub ↗

An Elastic easing used for ElasticOut functions.

Source from the content-addressed store, hash-verified

285 * An Elastic easing used for ElasticOut functions.
286 */
287 class ElasticOut extends Elastic {
288 public ElasticOut(float amplitude, float period) {
289 super(amplitude, period);
290 }
291
292 public ElasticOut() {
293 super();
294 }
295
296 public float ease(float t, float b, float c, float d) {
297 float a = getAmplitude();
298 float p = getPeriod();
299 if (t == 0) return b;
300 if ((t /= d) == 1) return b + c;
301 if (p == 0) p = d * .3f;
302 float s = 0;
303 if (a < Math.abs(c)) {
304 a = c;
305 s = p / 4;
306 } else s = p / (float) (2 * Math.PI) * (float) Math.asin(c / a);
307 return a * (float) Math.pow(2, -10 * t) * (float) Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
308 }
309 }
310
311 /**
312 * An Elastic easing used for ElasticInOut functions.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected