godot-start/script/demo10_animation/tween_animation.gd

13 lines
393 B
GDScript
Raw Normal View History

2021-10-07 10:38:10 +00:00
extends Sprite
onready var tween = $Tween
onready var targetPosition = get_node("/root/Node2D/TargetPosition")
# Called when the node enters the scene tree for the first time.
func _ready():
2022-07-09 09:08:36 +00:00
# 会在起始点和终点不断的插值计算
2021-10-07 10:38:10 +00:00
tween.follow_property(self, "position", get_position(), targetPosition, "position", 2.0, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
tween.start()
2022-07-09 09:28:47 +00:00
pass