local function p(p,E,u,z,a,X)if p==0 then return E end p=p/z if p==1 then return E+u end if not X then X=z*.3 end local F if not a or a<abs(u)then a=u F=X/4 else F=(X/(2*pi))*asin(u/a)end return((a*pow(2,-10*p))*sin(((p*z-F)*(2*pi))/X)+u)+E end
-- a: amplitud
-- p: period
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
