This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
Jessist/addons/godot-action/GDAction/Animating/FadeAlphaBy/GDActionNodeFadeAlpha.gd

29 lines
589 B
GDScript3
Raw Permalink Normal View History

2022-06-18 13:05:48 +02:00
class_name GDActionNodeFadeAlphaBy extends GDActionNodeInterval
var alpha_velocity: float = 0.0
func get_class() -> String:
return "GDActionNodeFadeAlphaBy"
func _init(action, key, node).(action, key, node):
pass
func _update(value: float, eased_value: float, delta: float):
node.modulate.a += self.alpha_velocity * delta
func fade_alpha_by(alpha_value, duration: float, delay = 0.0, speed = 1.0):
if duration <= 0:
finished()
return
self.alpha_velocity = alpha_value / duration
self.duration = duration
self.delay = delay
self.speed = speed
_reset_value()
_run()