local function q(q,w,M,Q,z,b)Q,z,b=default(Q,z,b)if q==0 then return Q end q=(q/b)*2 if q==2 then return Q+z end if not M then M=b*.45 end if not w then w=0 end local g if not w or w<abs(z)then w=z g=M/4 else g=(M/(2*pi))*asin(z/w)end if q<1 then q=q-1 return-0.5*((w*pow(2,10*q))*sin(((q*b-g)*(2*pi))/M))+Q else q=q-1 return(((w*pow(2,-10*q))*sin(((q*b-g)*(2*pi))/M))*.5+z)+Q end end
-- p = period
-- a = amplitud
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
