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/ScaleBy/GDActionNodeScaleBy.gd

35 lines
701 B
GDScript3
Raw Permalink Normal View History

2022-06-18 13:05:48 +02:00
class_name GDActionNodeScaleBy extends GDActionNodeInterval
var scale_velocity = Vector2.ZERO
func get_class() -> String:
return "GDActionNodeScaleBy"
func _init(action, key, node).(action, key, node):
pass
func _update(value: float, eased_value: float, delta: float):
match node_type:
NodeType.NODE_2D:
node.scale += self.scale_velocity * delta
NodeType.CONTROL:
node.rect_scale += self.scale_velocity * delta
func scale_by(by_vector_scale: Vector2, duration: float, delay: float, speed: float):
if duration <= 0.0:
finished()
self.scale_velocity = by_vector_scale / duration
self.duration = duration
self.delay = delay
self.speed = speed
_reset_value()
_run()