extends ColorRect

@export var intensity: float


# Called when the node enters the scene tree for the first time.
func _ready():
	var tween = get_tree().create_tween()
	tween.tween_method(_set_vignette, 0.0, 1.5, 0.5).set_trans(Tween.TRANS_LINEAR)
	tween.tween_method(_set_vignette, 1.5, 0.0, 0.5).set_trans(Tween.TRANS_LINEAR).set_delay(0.5)
	tween.set_loops()

func _set_vignette(value: float):
	var mat: ShaderMaterial = material
	mat.set_shader_parameter("vignette_strength", value * intensity)
