local function D(D,Y,n,g,u,T)if D==0 then return Y end D=D/g if D==1 then return Y+n end if not T then T=g*.3 end local Q if not u or u<abs(n)then u=n Q=T/4 else Q=(T/(2*pi))*asin(n/u)end return((u*pow(2,-10*D))*sin(((D*g-Q)*(2*pi))/T)+n)+Y end

local function outElastic(t, b, c, d, a, p)
  if t == 0 then return b end

  t = t / d

  if t == 1 then return b + c end

  if not p then p = d * 0.3 end

  local s

  if not a or a < abs(c) then
    a = c
    s = p / 4
  else
    s = p / (2 * pi) * asin(c/a)
  end

  return a * pow(2, -10 * t) * sin((t * d - s) * (2 * pi) / p) + c + b
end
