extends Button
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_button_down():
var tween = create_tween()
var initial_color = Color(0,0,0)
initial_color = $"../待机".modulate
var target_color = Color(1, 0, 0) # 蓝色
tween.tween_property($"../待机", "modulate:a", 0.0, 0.5)
tween.tween_property($"../待机", "modulate", target_color, 0.5)
tween.tween_property($"../待机", "modulate", initial_color, 0.5)
tween.tween_property($"../待机", "modulate:a", 1.0, 0.5)
tween.set_trans(Tween.TRANS_LINEAR)
tween.set_ease(Tween.EASE_IN_OUT)
tween.set_trans(Tween.TRANS_LINEAR)
tween.set_ease(Tween.EASE_IN_OUT)
pass # Replace with function body.
标签:godot,..,color,0.5,tween,待机,modulate
From: https://www.cnblogs.com/draft/p/18514459