local function x(x,B,t,W,w,R)W,w,R=default(W,w,R)if x==0 then return W end x=x/R if x==1 then return W+w end if not t then t=R*.3 end local l if not B or B<abs(w)then B=w l=t/4 else l=(t/(2*pi))*asin(w/B)end return((B*pow(2,-10*x))*sin(((x*R-l)*(2*pi))/t)+w)+W end

local function outElastic(t,a,p,b, c, d)
  b,c,d = default(b,c,d)
  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
