mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-06 07:50:22 +01:00
Add an optional extra RESET step in Tween demo (#892)
This commit is contained in:
@@ -121,10 +121,15 @@ func start_animation():
|
||||
tween.tween_callback(icon.show)
|
||||
tween.tween_callback(icon.set_self_modulate.bind(Color.WHITE))
|
||||
|
||||
# RESET step
|
||||
|
||||
if %Reset.button_pressed:
|
||||
tween.tween_callback(reset.bind(true))
|
||||
|
||||
func do_countdown(v):
|
||||
countdown_label.text = str(v)
|
||||
|
||||
func reset():
|
||||
func reset(soft := false):
|
||||
icon.position = icon_start_position
|
||||
icon.self_modulate = Color.WHITE
|
||||
icon.rotation = 0
|
||||
@@ -132,6 +137,10 @@ func reset():
|
||||
icon.show()
|
||||
countdown_label.hide()
|
||||
|
||||
if soft:
|
||||
# Only reset properties.
|
||||
return
|
||||
|
||||
if tween:
|
||||
tween.kill()
|
||||
tween = null
|
||||
|
||||
@@ -68,6 +68,14 @@ unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Infinite?"
|
||||
|
||||
[node name="Reset" type="CheckBox" parent="VBoxContainer/PanelContainer/VBoxContainer/HBoxContainer3"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
tooltip_text = "If enabled, the Tween will take an extra step to ensure
|
||||
that all properties are restored to their initial value."
|
||||
button_pressed = true
|
||||
text = "Reset Between Loops?"
|
||||
|
||||
[node name="Button" type="Button" parent="VBoxContainer/PanelContainer/VBoxContainer/HBoxContainer3"]
|
||||
layout_mode = 2
|
||||
text = "Start Animation"
|
||||
|
||||
Reference in New Issue
Block a user