init
This commit is contained in:
commit
18efc36800
161 changed files with 5008 additions and 0 deletions
44
scripts/effects/shadow.gd
Normal file
44
scripts/effects/shadow.gd
Normal file
|
@ -0,0 +1,44 @@
|
|||
extends Sprite2D
|
||||
|
||||
@export var powerOnCurve: Curve
|
||||
@export var shutDownCurve: Curve
|
||||
var time: float
|
||||
@export var duration: float
|
||||
|
||||
@export var bubbleMask: Sprite2D
|
||||
|
||||
var curve: Curve
|
||||
var animating: bool = false
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
if (not animating):
|
||||
return
|
||||
|
||||
time += delta
|
||||
var alpha = curve.sample(clamp(time / duration, 0, 1))
|
||||
modulate = Color(Color.WHITE, alpha)
|
||||
bubbleMask.modulate = Color(Color.WHITE, alpha)
|
||||
if (time >= duration):
|
||||
animating = false
|
||||
|
||||
|
||||
func shut_down():
|
||||
time = 0
|
||||
curve = shutDownCurve
|
||||
animating = true
|
||||
|
||||
|
||||
func power_on():
|
||||
time = 0
|
||||
curve = powerOnCurve
|
||||
animating = true
|
||||
|
||||
|
||||
func _on_lights_out():
|
||||
shut_down()
|
||||
|
||||
|
||||
func _on_lights_in():
|
||||
power_on()
|
Loading…
Add table
Add a link
Reference in a new issue