local function t(t,P,W,Y,b,i)Y,b,i=default(Y,b,i)if t==0 then return Y end t=(t/i)*2 if t==2 then return Y+b end if not W then W=i*.45 end if not P then P=0 end local D if not P or P<abs(b)then P=b D=W/4 else D=(W/(2*pi))*asin(b/P)end if t<1 then t=t-1 return-0.5*((P*pow(2,10*t))*sin(((t*i-D)*(2*pi))/W))+Y else t=t-1 return(((P*pow(2,-10*t))*sin(((t*i-D)*(2*pi))/W))*.5+b)+Y end end

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

  t = t / d * 2

  if t == 2 then return b + c end

  if not p then p = d * (0.3 * 1.5) end
  if not a then a = 0 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

  if t < 1 then
    t = t - 1
    return -0.5 * (a * pow(2, 10 * t) * sin((t * d - s) * (2 * pi) / p)) + b
  else
    t = t - 1
    return a * pow(2, -10 * t) * sin((t * d - s) * (2 * pi) / p ) * 0.5 + c + b
  end
end
