-- initialize camera shaker object

local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
	camera.CFrame = camera.CFrame * shakeCf
end)
camShake:Start()

local CameraShake = {}

function CameraShake.ShakeOnce()
	if not tool:GetAttribute('CameraShake') then return end
	-- CameraShaker:ShakeOnce(magnitude, roughness [, fadeInTime, fadeOutTime, posInfluence, rotInfluence])
	camShake:ShakeOnce(5, 20 , 0, 1.5, Vector3.new(.5,.5,.5), Vector3.new())
end

function CameraShake.ShakeSustain()
	if not tool:GetAttribute('CameraShake') then return end
	camShake:ShakeSustain(CameraShaker.Presets.Earthquake)
end

function CameraShake.StopSustained()
	if not tool:GetAttribute('CameraShake') then return end
	camShake:StopSustained(1)
end

return CameraShake
