diff --git a/2d/tween/main.gd b/2d/tween/main.gd index cc9bbcdf..eb4b0d91 100644 --- a/2d/tween/main.gd +++ b/2d/tween/main.gd @@ -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 diff --git a/2d/tween/main.tscn b/2d/tween/main.tscn index 81fa13ec..3bdcc9a1 100644 --- a/2d/tween/main.tscn +++ b/2d/tween/main.tscn @@ -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"