local p=require((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\078\101\118\101\114\109\111\114\101"))local N=p("\083\112\114\105\110\103")local q=p("\083\117\109\109\101\100\067\097\109\101\114\097")local k={}k.ClassName="\070\097\100\105\110\103\067\097\109\101\114\097"function k.new(p)local q=setmetatable({},k)q.Spring=N.new(0)q.Camera=p or error("\078\111 \099\097\109\101\114\097")q.Damper=1 q.Speed=15 return q end function k.__add(N,p)return q.new(N,p)end function k.__newindex(q,p,N)if p=="\068\097\109\112\101\114"then q.Spring.Damper=N elseif p=="\118\097\108\117\101"then q.Spring.Value=N elseif p=="\083\112\101\101\100"then q.Spring.Speed=N elseif p=="\084\097\114\103\101\116"then q.Spring.Target=N elseif p=="\083\112\114\105\110\103"or p=="\067\097\109\101\114\097"then rawset(q,p,N)else error(p.." \105\115 \110\111\116 \097 \118\097\108\105\100 \109\101\109\098\101\114 \111\102 \102\097\100\105\110\103 \099\097\109\101\114\097")end end function k.__index(N,p)if p=="\083\116\097\116\101"or p=="\067\097\109\101\114\097\083\116\097\116\101"or p=="\067\097\109\101\114\097"then return(N.Camera.CameraState or N.Camera)*N.Spring.Value elseif p=="\068\097\109\112\101\114"then return N.Spring.Damper elseif p=="\118\097\108\117\101"then return N.Spring.Value elseif p=="\083\112\101\101\100"then return N.Spring.Speed elseif p=="\084\097\114\103\101\116"then return N.Spring.Target elseif p=="\086\101\108\111\099\105\116\121"then return N.Spring.Velocity elseif p=="\072\097\115\082\101\097\099\104\101\100\084\097\114\103\101\116"then return math.abs(N.Value-N.Target)<.0001 and math.abs(N.Velocity)<.0001 else return k[p]end end return k
--- Add another layer of effects that can be faded in/out
-- @classmod FadingCamera

local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))

local Spring = require("Spring")
local SummedCamera = require("SummedCamera")

local FadingCamera = {}
FadingCamera.ClassName = "FadingCamera"

function FadingCamera.new(camera)
	local self = setmetatable({}, FadingCamera)

	self.Spring = Spring.new(0)

	self.Camera = camera or error("No camera")
	self.Damper = 1
	self.Speed = 15

	return self
end

function FadingCamera:__add(other)
	return SummedCamera.new(self, other)
end

function FadingCamera:__newindex(index, value)
	if index == "Damper" then
		self.Spring.Damper = value
	elseif index == "value" then
		self.Spring.Value = value
	elseif index == "Speed" then
		self.Spring.Speed = value
	elseif index == "Target" then
		self.Spring.Target = value
	elseif index == "Spring" or index == "Camera" then
		rawset(self, index, value)
	else
		error(index .. " is not a valid member of fading camera")
	end
end

function FadingCamera:__index(index)
	if index == "State" or index == "CameraState" or index == "Camera" then
		return (self.Camera.CameraState or self.Camera) * self.Spring.Value
	elseif index == "Damper" then
		return self.Spring.Damper
	elseif index == "value" then
		return self.Spring.Value
	elseif index == "Speed" then
		return self.Spring.Speed
	elseif index == "Target" then
		return self.Spring.Target
	elseif index == "Velocity" then
		return self.Spring.Velocity
	elseif index == "HasReachedTarget" then
		return math.abs(self.Value - self.Target) < 1e-4 and math.abs(self.Velocity) < 1e-4
	else
		return FadingCamera[index]
	end
end

return FadingCamera