EaseElasticInOut method

double EaseElasticInOut(
  1. num t,
  2. num b,
  3. num c,
  4. num d,
)

Elastic In Out

Implementation

double EaseElasticInOut(num t, num b, num c, num d) => run(
  () => _debugLabel('EaseElasticInOut', t, b, c, d),
  () {
    if (t == 0.0) return b.toDouble();
    if ((t/=d/2.0) == 2.0) return (b + c).toDouble();

    final p = d*(0.3*1.5);
    final a = c;
    final s = p/4.0;

    if (t < 1.0) {
      final postFix = a*math.pow(2.0, 10.0*(t-=1.0));
      return -0.5*(postFix*math.sin((t*d-s)*(2.0*rl.PI)/p)) + b;
    }

    final postFix = a*math.pow(2.0, -10.0*(t-=1.0));

    return (postFix*math.sin((t*d-s)*(2.0*rl.PI)/p)*0.5 + c + b);
  },
);