local w=0 spring={mt={}}spring.mt.__index=spring function spring.new(w)local l=tick()local R=w or 0 local O=w and 0*w or 0 local q=w or 0 local e=1 local C=1 local function E(w)local E=w-l local V=R-q if C==0 then return R,0 elseif e<1 then local w=(1-e*e)^.5 local l=(O/C+e*V)/w local R=math.cos((w*C)*E)local a=math.sin((w*C)*E)local u=2.718281828459^((e*C)*E)return q+(V*R+l*a)/u,(C*((w*l-e*V)*R-(w*V+e*l)*a))/u else local w=O/C+V local l=2.718281828459^(C*E)return q+(V+(w*C)*E)/l,(C*((w-V)-(w*C)*E))/l end end return setmetatable({},{__index=function(w,V)if V=="\118\097\108\117\101"or V=="\112\111\115\105\116\105\111\110"or V=="\112"then local w,l=E(tick())return w elseif V=="\118\101\108\111\099\105\116\121"or V=="\118"then local w,l=E(tick())return l elseif V=="\097\099\099\101\108\101\114\097\116\105\111\110"or V=="\097"then local w=tick()-l local E=R-q if C==0 then return 0 elseif e<1 then local l=(1-e*e)^.5 local R=(O/C+e*E)/l return((C*C)*((((e*e)*E-((2*l)*e)*R)-(l*l)*E)*math.cos((l*C)*w)+(((e*e)*R+((2*l)*e)*E)-(l*l)*R)*math.sin((l*C)*w)))/2.718281828459^((e*C)*w)else local l=O/C+E return((C*C)*((E-2*l)+(l*C)*w))/2.718281828459^(C*w)end elseif V=="\116\097\114\103\101\116"or V=="\116"then return q elseif V=="\100\097\109\112\101\114"or V=="\100"then return e elseif V=="\115\112\101\101\100"or V=="\115"then return C end end,__newindex=function(w,V,a)local u=tick()if V=="\118\097\108\117\101"or V=="\112\111\115\105\116\105\111\110"or V=="\112"then local w,l=E(u)R,O=a,l elseif V=="\118\101\108\111\099\105\116\121"or V=="\118"then local w,l=E(u)R,O=w,a elseif V=="\097\099\099\101\108\101\114\097\116\105\111\110"or V=="\097"then local w,l=E(u)R,O=w,l+a elseif V=="\116\097\114\103\101\116"or V=="\116"then R,O=E(u)q=a elseif V=="\100\097\109\112\101\114"or V=="\100"then R,O=E(u)e=a<0 and 0 or a<1 and a or 1 elseif V=="\115\112\101\101\100"or V=="\115"then R,O=E(u)C=a<0 and 0 or a end l=u end})end return spring

	--local runtime = game ("GetService", "RunService")
	local t = 0
	
	spring = {mt = {}}
	spring.mt.__index = spring
	
	function spring.new( initial )
		local t0 = tick()
		local p0 = initial or 0
		local v0 = initial and 0 * initial or 0
		local t	= initial or 0
		local d	= 1
		local s = 1
		
		local function positionvelocity(tick)
			local x			=tick-t0
			local c0		=p0-t
			if s==0 then
				return		p0,0
			elseif d<1 then
				local c		=(1-d*d)^0.5
				local c1	=(v0/s+d*c0)/c
				local co	=math.cos(c*s*x)
				local si	=math.sin(c*s*x)
				local e		=2.718281828459045^(d*s*x)
				return		t+(c0*co+c1*si)/e,
							s*((c*c1-d*c0)*co-(c*c0+d*c1)*si)/e
			else
				local c1	=v0/s+c0
				local e		=2.718281828459045^(s*x)
				return		t+(c0+c1*s*x)/e,
							s*(c1-c0-c1*s*x)/e
			end
		end
		return setmetatable({},{
			__index=function(_, index)
				if index == "value" or index == "position" or index == "p" then
					local p,v = positionvelocity(tick())
					return p
				elseif index == "velocity" or index == "v" then
					local p,v = positionvelocity(tick())
					return v
				elseif index == "acceleration" or index == "a" then
					local x	= tick()-t0
					local c0 = p0-t
					if s == 0 then
						return 0
					elseif d < 1 then
						local c	=(1-d*d)^0.5
						local c1 = (v0/s+d*c0)/c
						return s*s*((d*d*c0-2*c*d*c1-c*c*c0)*math.cos(c*s*x)
								+(d*d*c1+2*c*d*c0-c*c*c1)*math.sin(c*s*x))
								/2.718281828459045^(d*s*x)
					else
						local c1 = v0/s+c0
						return s*s*(c0-2*c1+c1*s*x)
								/2.718281828459045^(s*x)
					end
				elseif index == "target" or index == "t" then
					return t
				elseif index == "damper" or index == "d" then
					return d
				elseif index == "speed" or index == "s" then
					return s
				end
			end;
			__newindex=function(_, index, value)
				local time = tick()
				if index == "value" or index == "position" or index == "p" then
					local p,v = positionvelocity(time)
					p0, v0 = value, v
				elseif index == "velocity" or index == "v" then
					local p,v = positionvelocity(time)
					p0, v0 = p, value
				elseif index == "acceleration" or index == "a" then
					local p, v = positionvelocity(time)
					p0, v0 = p, v + value
				elseif index == "target" or index == "t" then
					p0, v0 = positionvelocity(time)
					t = value
				elseif index == "damper" or index == "d" then
					p0, v0 = positionvelocity(time)
					d = value < 0 and 0 or value < 1 and value or 1
				elseif index == "speed" or index == "s" then
					p0, v0 = positionvelocity(time)
					s = value < 0 and 0 or value
				end
				t0 = time
			end;
		})
	end
return spring
