diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index f9486e658..fabe337c6 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -495,11 +495,8 @@ func dialog_open(open: bool) -> void: else: can_draw = true - control.get_node("ModulateTween").interpolate_property( - control, "modulate", control.modulate, dim_color, 0.1, Tween.TRANS_LINEAR, Tween.EASE_OUT - ) - - control.get_node("ModulateTween").start() + var tween := create_tween().set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_OUT) + tween.tween_property(control, "modulate", dim_color, 0.1) func disable_button(button: BaseButton, disable: bool) -> void: diff --git a/src/Main.tscn b/src/Main.tscn index 642d5d8d3..b10276b59 100644 --- a/src/Main.tscn +++ b/src/Main.tscn @@ -137,8 +137,6 @@ visible = false [node name="RightCursor" type="Sprite" parent="."] visible = false -[node name="ModulateTween" type="Tween" parent="."] - [connection signal="popup_hide" from="Dialogs/SplashDialog" to="." method="_can_draw_true"] [connection signal="popup_hide" from="Dialogs/CreateNewImage" to="." method="_can_draw_true"] [connection signal="files_selected" from="Dialogs/OpenSprite" to="." method="_on_OpenSprite_files_selected"] diff --git a/src/UI/Canvas/CameraMovement.gd b/src/UI/Canvas/CameraMovement.gd index 39fd6c7c5..21cc22a4c 100644 --- a/src/UI/Canvas/CameraMovement.gd +++ b/src/UI/Canvas/CameraMovement.gd @@ -5,7 +5,6 @@ enum Cameras { MAIN, SECOND, SMALL } const KEY_MOVE_ACTION_NAMES := ["camera_left", "camera_right", "camera_up", "camera_down"] const CAMERA_SPEED_RATE := 15.0 -var tween: Tween var zoom_min := Vector2(0.005, 0.005) var zoom_max := Vector2.ONE var viewport_container: ViewportContainer @@ -19,9 +18,6 @@ func _ready() -> void: rotating = true viewport_container = get_parent().get_parent() transparent_checker = get_parent().get_node("TransparentChecker") - tween = Tween.new() - add_child(tween) - tween.connect("tween_step", self, "_on_tween_step") update_transparent_checker_offset() # signals regarding rotation stats @@ -180,13 +176,11 @@ func zoom_camera(dir: int) -> void: offset + (-0.5 * viewport_size + mouse_pos).rotated(rotation) * (zoom - new_zoom) ) - tween.interpolate_property( - self, "zoom", zoom, new_zoom, 0.05, Tween.TRANS_LINEAR, Tween.EASE_IN - ) - tween.interpolate_property( - self, "offset", offset, new_offset, 0.05, Tween.TRANS_LINEAR, Tween.EASE_IN - ) - tween.start() + var tween := create_tween().set_parallel() + tween.set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_IN) + tween.connect("step_finished", self, "_on_tween_step") + tween.tween_property(self, "zoom", new_zoom, 0.05) + tween.tween_property(self, "offset", new_offset, 0.05) else: var prev_zoom := zoom @@ -205,10 +199,9 @@ func zoom_camera_percent(value: float) -> void: var percent: float = 100.0 / value var new_zoom = Vector2(percent, percent) if Global.smooth_zoom: - tween.interpolate_property( - self, "zoom", zoom, new_zoom, 0.05, Tween.TRANS_LINEAR, Tween.EASE_IN - ) - tween.start() + var tween := create_tween().set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_IN) + tween.connect("step_finished", self, "_on_tween_step") + tween.tween_property(self, "zoom", new_zoom, 0.05) else: zoom = new_zoom zoom_changed() @@ -234,7 +227,7 @@ func _update_rulers() -> void: Global.vertical_ruler.update() -func _on_tween_step(_object: Object, _key: NodePath, _elapsed: float, _value: Object) -> void: +func _on_tween_step(_idx: int) -> void: zoom_changed() diff --git a/src/UI/NotificationLabel.gd b/src/UI/NotificationLabel.gd index d69a3b563..03a6e3340 100644 --- a/src/UI/NotificationLabel.gd +++ b/src/UI/NotificationLabel.gd @@ -2,26 +2,9 @@ extends Label func _ready() -> void: - var tween := $Tween - tween.interpolate_property( - self, - "rect_position", - rect_position, - Vector2(rect_position.x, rect_position.y - 100), - 1, - Tween.TRANS_LINEAR, - Tween.EASE_OUT - ) - tween.interpolate_property( - self, - "modulate", - modulate, - Color(modulate.r, modulate.g, modulate.b, 0), - 1, - Tween.TRANS_LINEAR, - Tween.EASE_OUT - ) - tween.start() + var tw := create_tween().set_parallel().set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_OUT) + tw.tween_property(self, "rect_position", Vector2(rect_position.x, rect_position.y - 100), 1) + tw.tween_property(self, "modulate", Color(modulate.r, modulate.g, modulate.b, 0), 1) func _on_Timer_timeout() -> void: diff --git a/src/UI/NotificationLabel.tscn b/src/UI/NotificationLabel.tscn index 463bb0fb9..301184d89 100644 --- a/src/UI/NotificationLabel.tscn +++ b/src/UI/NotificationLabel.tscn @@ -2,8 +2,6 @@ [ext_resource path="res://src/UI/NotificationLabel.gd" type="Script" id=2] - - [node name="NotificationLabel" type="Label"] margin_right = 116.0 margin_bottom = 14.0 @@ -14,9 +12,8 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Tween" type="Tween" parent="."] - [node name="Timer" type="Timer" parent="."] one_shot = true autostart = true + [connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]