hurrmmm/godot/tests/control_scheme/screen_shader.gd

20 lines
499 B
GDScript

extends Control
@onready var shader: ShaderMaterial = $ColorRect.material
@onready var amount = TAS_System.speed
@onready var target_amount = TAS_System.speed
func _ready():
set_amount(TAS_System.speed)
TAS_System.SpeedChange.connect(set_amount)
func set_amount(speed: float):
target_amount = (speed - TAS_System.min_speed) / (TAS_System.max_speed - TAS_System.min_speed)
func _process(_delta):
amount = lerp(amount, target_amount, 0.1)
shader.set_shader_parameter("amount", amount*3)