-
-
Notifications
You must be signed in to change notification settings - Fork 124
/
CustomCameraEffect.lua
44 lines (35 loc) · 1013 Bytes
/
CustomCameraEffect.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--[=[
For effects that can be easily bound in scope
@class CustomCameraEffect
]=]
local require = require(script.Parent.loader).load(script)
local SummedCamera = require("SummedCamera")
local CustomCameraEffect = {}
CustomCameraEffect.ClassName = "CustomCameraEffect"
--[=[
Constructs a new custom camera effect
@param getCurrentStateFunc () -> CameraState -- Custom effect generator
@return CustomCameraEffect
]=]
function CustomCameraEffect.new(getCurrentStateFunc)
local self = setmetatable({}, CustomCameraEffect)
self._getCurrentStateFunc = getCurrentStateFunc or error("getCurrentStateFunc is required")
return self
end
function CustomCameraEffect:__add(other)
return SummedCamera.new(self, other)
end
--[=[
The current state.
@readonly
@prop CameraState CameraState
@within CustomCameraEffect
]=]
function CustomCameraEffect:__index(index)
if index == "CameraState" then
return self._getCurrentStateFunc()
else
return CustomCameraEffect[index]
end
end
return CustomCameraEffect