godot tween

eva1024發表於2024-10-29
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.

相關文章