-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfade.lua
More file actions
49 lines (34 loc) · 1018 Bytes
/
Copy pathfade.lua
File metadata and controls
49 lines (34 loc) · 1018 Bytes
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
45
46
47
48
49
-- todo logarithmic lighten
local width = get("Velo.screenWidth")
local height = get("Velo.screenHeight")
local pos = Vector2:new(0, 0)
local size = Vector2:new(width, height)
local alpha = 0
local max = 100
local darken_rate = 3 -- the speed at which the screen darkens
local lighten_rate = 0.1 -- the speed at which the screen returns to normal
-- p sure this isn't framerate dependent bt whatever
onPostUpdate = function()
dt = get("Velo.delta")
a = get("Player.boostHeld")
b = get("Player.isUsingBoost")
-- echo(tostring(alpha))
-- echo(tostring(dt))
if a and b then
alpha = alpha + (darken_rate)
else
alpha = alpha - (lighten_rate)
end
if alpha > 255 then
alpha = 255
end
if alpha < 0 then
alpha = 0
end
end
-- ontop of last layer so you can atleast see velo
onPostDrawLayer = function(layer)
if layer == "TrailInFrontOfLocalPlayersLayer" then
drawRect(pos, size, Color:new(0, 0, 0, alpha))
end
end