local function Z(Z,e,t,U,J,f)U,J,f=default(U,J,f)U,J,f=default(U,J,f)if Z<f/2 then return outElastic(Z*2,U,J/2,f,e,t)else return inElastic(Z*2-f,U+J/2,J/2,f,e,t)end end local function e(Z,e,t,U,J)t,U,J=default(t,U,J)if not e then e=1.70158 end Z=Z/J return((U*Z)*Z)*((e+1)*Z-e)+t end local function t(Z,e,t,U,J)e,t,U=default(e,t,U)if not J then J=1.70158 end Z=Z/U-1 return t*((Z*Z)*((J+1)*Z+J)+1)+e end local function U(Z,e,t,U,J)t,U,J=default(t,U,J)if not e then e=1.70158 end e=e*1.525 Z=(Z/J)*2 if Z<1 then return(U/2)*((Z*Z)*((e+1)*Z-e))+t else Z=Z-2 return(U/2)*((Z*Z)*((e+1)*Z+e)+2)+t end end local function J(Z,U,J,f,B)J,f,B=default(J,f,B)if Z<B/2 then return t(Z*2,J,f/2,B,U)else return e(Z*2-B,J+f/2,f/2,B,U)end end local function f(Z,e,t,U)e,t,U=default(e,t,U)Z=Z/U if Z<.36363636363636 then return t*((7.5625*Z)*Z)+e elseif Z<.72727272727273 then Z=Z-.54545454545455 return t*((7.5625*Z)*Z+.75)+e elseif Z<.90909090909091 then Z=Z-.81818181818182 return t*((7.5625*Z)*Z+.9375)+e else Z=Z-.95454545454545 return t*((7.5625*Z)*Z+.984375)+e end end local function B(Z,e,t,U)e,t,U=default(e,t,U)return(t-f(U-Z,0,t,U))+e end local function D(Z,e,t,U)e,t,U=default(e,t,U)if Z<U/2 then return B(Z*2,0,t,U)*.5+e else return(f(Z*2-U,0,t,U)*.5+t*.5)+e end end local function i(Z,e,t,U)e,t,U=default(e,t,U)if Z<U/2 then return f(Z*2,e,t/2,U)else return B(Z*2-U,e+t/2,t/2,U)end end module={Linear=linear,InQuad=inQuad;OutQuad=outQuad;InOutQuad=inOutQuad;OutInQuad=outInQuad,InCubic=inCubic,OutCubic=outCubic,InOutCubic=inOutCubic,OutInCubic=outInCubic;InQuart=inQuart,OutQuart=outQuart,InOutQuart=inOutQuart,OutInQuart=outInQuart;InQuint=inQuint;OutQuint=outQuint,InOutQuint=inOutQuint;OutInQuint=outInQuint;InSine=inSine,OutSine=outSine;InOutSine=inOutSine;OutInSine=outInSine;InExpo=inExpo;OutExpo=outExpo;InOutExpo=inOutExpo,OutInExpo=outInExpo;InCirc=inCirc;OutCirc=outCirc;InOutCirc=inOutCirc;OutInCirc=outInCirc,InElastic=inElastic;OutElastic=outElastic;InOutElastic=inOutElastic,OutInElastic=Z,InBack=e,OutBack=t,InOutBack=U;OutInBack=J,InBounce=B;OutBounce=f,InOutBounce=D;OutInBounce=i}return module
-- a: amplitud
-- p: period
local function outInElastic(t, a, p, b, c, d)
	b, c, d = default(b, c, d)
	b, c, d = default(b, c, d)
	if t < d / 2 then
		return outElastic(t * 2, b, c / 2, d, a, p)
	else
		return inElastic((t * 2) - d, b + c / 2, c / 2, d, a, p)
	end
end

local function inBack(t, s, b, c, d)
	b, c, d = default(b, c, d)

	if not s then
		s = 1.70158
	end
	t = t / d
	return c * t * t * ((s + 1) * t - s) + b
end

local function outBack(t, b, c, d, s)
	b, c, d = default(b, c, d)

	if not s then
		s = 1.70158
	end
	t = t / d - 1
	return c * (t * t * ((s + 1) * t + s) + 1) + b
end

local function inOutBack(t, s, b, c, d)
	b, c, d = default(b, c, d)

	if not s then
		s = 1.70158
	end
	s = s * 1.525
	t = t / d * 2
	if t < 1 then
		return c / 2 * (t * t * ((s + 1) * t - s)) + b
	else
		t = t - 2
		return c / 2 * (t * t * ((s + 1) * t + s) + 2) + b
	end
end

local function outInBack(t, s, b, c, d)
	b, c, d = default(b, c, d)

	if t < d / 2 then
		return outBack(t * 2, b, c / 2, d, s)
	else
		return inBack((t * 2) - d, b + c / 2, c / 2, d, s)
	end
end

local function outBounce(t, b, c, d)
	b, c, d = default(b, c, d)

	t = t / d
	if t < 1 / 2.75 then
		return c * (7.5625 * t * t) + b
	elseif t < 2 / 2.75 then
		t = t - (1.5 / 2.75)
		return c * (7.5625 * t * t + 0.75) + b
	elseif t < 2.5 / 2.75 then
		t = t - (2.25 / 2.75)
		return c * (7.5625 * t * t + 0.9375) + b
	else
		t = t - (2.625 / 2.75)
		return c * (7.5625 * t * t + 0.984375) + b
	end
end

local function inBounce(t, b, c, d)
	b, c, d = default(b, c, d)

	return c - outBounce(d - t, 0, c, d) + b
end

local function inOutBounce(t, b, c, d)
	b, c, d = default(b, c, d)

	if t < d / 2 then
		return inBounce(t * 2, 0, c, d) * 0.5 + b
	else
		return outBounce(t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b
	end
end

local function outInBounce(t, b, c, d)
	b, c, d = default(b, c, d)

	if t < d / 2 then
		return outBounce(t * 2, b, c / 2, d)
	else
		return inBounce((t * 2) - d, b + c / 2, c / 2, d)
	end
end

module = {
	Linear = linear,
	InQuad = inQuad,
	OutQuad = outQuad,
	InOutQuad = inOutQuad,
	OutInQuad = outInQuad,
	InCubic = inCubic,
	OutCubic = outCubic,
	InOutCubic = inOutCubic,
	OutInCubic = outInCubic,
	InQuart = inQuart,
	OutQuart = outQuart,
	InOutQuart = inOutQuart,
	OutInQuart = outInQuart,
	InQuint = inQuint,
	OutQuint = outQuint,
	InOutQuint = inOutQuint,
	OutInQuint = outInQuint,
	InSine = inSine,
	OutSine = outSine,
	InOutSine = inOutSine,
	OutInSine = outInSine,
	InExpo = inExpo,
	OutExpo = outExpo,
	InOutExpo = inOutExpo,
	OutInExpo = outInExpo,
	InCirc = inCirc,
	OutCirc = outCirc,
	InOutCirc = inOutCirc,
	OutInCirc = outInCirc,
	InElastic = inElastic,
	OutElastic = outElastic,
	InOutElastic = inOutElastic,
	OutInElastic = outInElastic,
	InBack = inBack,
	OutBack = outBack,
	InOutBack = inOutBack,
	OutInBack = outInBack,
	InBounce = inBounce,
	OutBounce = outBounce,
	InOutBounce = inOutBounce,
	OutInBounce = outInBounce,
}
return module
