9 lines
368 B
GDScript
9 lines
368 B
GDScript
static func linear_goto(node: Node, dest: Vector2, duration=0.5, easing=true):
|
|
var tween = Tween.new()
|
|
node.add_child(tween)
|
|
tween.interpolate_property(
|
|
node, "rect_position" if node is Control else "position",
|
|
node.rect_position if node is Control else node.position, dest, duration,
|
|
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT if easing else null)
|
|
tween.start()
|