summaryrefslogtreecommitdiff
path: root/addons/crt_shader/CRTShader.gd
blob: 464b275f80d732d73e0998b47d47e9b16fc06dc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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()