summaryrefslogtreecommitdiff
path: root/addons/crt_shader/CRTShader.gd
diff options
context:
space:
mode:
Diffstat (limited to 'addons/crt_shader/CRTShader.gd')
-rw-r--r--addons/crt_shader/CRTShader.gd23
1 files changed, 23 insertions, 0 deletions
diff --git a/addons/crt_shader/CRTShader.gd b/addons/crt_shader/CRTShader.gd
new file mode 100644
index 0000000..464b275
--- /dev/null
+++ b/addons/crt_shader/CRTShader.gd
@@ -0,0 +1,23 @@
+extends ColorRect
+
+onready var glitch_loop = false
+onready var fun = null
+
+func _ready():
+ $GlitchAnimation.connect("animation_finished", self, "_on_animation_finished")
+
+func _on_animation_finished(anim):
+ if anim == "Glitch" and glitch_loop:
+ $GlitchAnimation.play("GlitchLoop")
+
+func start_glitch_loop():
+ $GlitchAnimation.play("GlitchLoop")
+ glitch_loop = true
+
+func tween(fun : FuncRef, force = false):
+ if not force and $GlitchAnimation.is_playing() and $GlitchAnimation.current_animation == "Glitch": return
+ $GlitchAnimation.play("Glitch")
+ self.fun = fun
+
+func call_funcref():
+ if fun: fun.call_func()