diff options
author | Henrique Alves <henriquelalves@gmail.com> | 2022-09-24 22:00:50 -0300 |
---|---|---|
committer | Henrique Alves <henriquelalves@gmail.com> | 2022-09-24 22:00:50 -0300 |
commit | 1b13dfdd3768c172c7c0abe644383df14de12fb6 (patch) | |
tree | 2f7e8ff86fa28dca291345f2a66ade252de67f79 /addons/crt_shader/CRTShader.gd | |
parent | 0edaddac2193bb84de5b9bd915ac9264de6fe8e8 (diff) | |
download | plugin-godot-simple-crt-shader-1b13dfdd3768c172c7c0abe644383df14de12fb6.tar.gz plugin-godot-simple-crt-shader-1b13dfdd3768c172c7c0abe644383df14de12fb6.tar.bz2 plugin-godot-simple-crt-shader-1b13dfdd3768c172c7c0abe644383df14de12fb6.zip |
Add CRTCanvasLayer scene
Diffstat (limited to 'addons/crt_shader/CRTShader.gd')
-rw-r--r-- | addons/crt_shader/CRTShader.gd | 23 |
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() |