local function s(s,d,h,F,o,A)if s==0 then return d end s=s/F if s==1 then return d+h end if not A then A=F*.3 end local M if not o or o<abs(h)then o=h M=A/4 else M=(A/(2*pi))*asin(h/o)end return((o*pow(2,-10*s))*sin(((s*F-M)*(2*pi))/A)+h)+d 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
