以下几点下面的范例中都有体现:
-
运行时创建
Tween
的话不要忘了将其加入节点树 -
如果要给一个Tween行为注册回调函数,注册一次就可以
-
Tween行为时临时的,执行完毕以后不再保存,所以下次start前要重新定义
extends Node
var tween : Tween
func _ready():
tween = Tween.new()
add_child(tween)#加入节点树
tween.connect("tween_all_completed",self,"tween_all_completed")
#tween.interpolate_property(self,"rotation_degrees",Vector3(0,init_degree,0),Vector3(0,final_degree,0),duration,Tween.TRANS_LINEAR,Tween.EASE_IN)
func play():
#tween.connect("tween_all_completed",self,"tween_all_completed")
tween.interpolate_property(self,"rotation_degrees",Vector3(0,0,0),Vector3(0,90,0),0.2,Tween.TRANS_LINEAR,Tween.EASE_IN)
tween.start()