godot tween

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.
posted @ 2024-10-29 21:02  eva1024  阅读(4)  评论(0编辑  收藏  举报