local function o(o,T,u,z,W,S)if o==0 then return T end o=(o/z)*2 if o==2 then return T+u end if not S then S=z*.45 end if not W then W=0 end if not W or W<abs(u)then W=u s=S/4 else s=(S/(2*pi))*asin(u/W)end if o<1 then o=o-1 return-0.5*((W*pow(2,10*o))*sin(((o*z-s)*(2*pi))/S))+T else o=o-1 return(((W*pow(2,-10*o))*sin(((o*z-s)*(2*pi))/S))*.5+u)+T end end
-- p = period
-- a = amplitud
local function inOutElastic(t, b, c, d, a, p)
	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

	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
