From 7de83600f54f002520585a3096dc47556dd536a2 Mon Sep 17 00:00:00 2001 From: Adrian Schmid Date: Sat, 15 Jul 2023 15:59:22 +0200 Subject: [PATCH] added quick tween to post its which are attached to cards or returned to the panels --- src/logic-scenes/board/card-board.gd | 18 +++++++++--------- src/logic-scenes/board/post-it.gd | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/logic-scenes/board/card-board.gd b/src/logic-scenes/board/card-board.gd index 7bd6f8a..7866243 100644 --- a/src/logic-scenes/board/card-board.gd +++ b/src/logic-scenes/board/card-board.gd @@ -345,7 +345,7 @@ func _enter_assignment_context(): # move the post it so it floats next to the card where it should be attached func _select_card_for_assigning(post_it: Area2D, card: Area2D): - post_it.global_position = card.get_child(3).global_position + Vector2(0, 50) + post_it.tween_transform_to(card.get_child(3).global_position + Vector2(0, 50)) # leaves the context for assigning postit via button controls func _leave_assignment_context(): @@ -354,16 +354,16 @@ func _leave_assignment_context(): currently_selected_node = currently_selected_card_for_assigning # handles everything to return a post it to the panels -func _return_postit_to_panels(postit: Area2D): +func _return_postit_to_panels(post_it: Area2D): for panel in area_dict["post_it_panels"]: if panel.get_child_count() == 1: - postit.reparent(panel) - postit.set_owner(self) - area_dict["dropzone_content"].erase(postit) - area_dict["post_its_in_list"].push_back(postit) - postit.position = panel.get_child(0).position - postit.rotation = postit.base_rotation - postit.scale = postit.base_scale + area_dict["dropzone_content"].erase(post_it) + area_dict["post_its_in_list"].push_back(post_it) + post_it.tween_transform_to(panel.get_child(0).position) + post_it.rotation = post_it.base_rotation + post_it.scale = post_it.base_scale + post_it.reparent(panel) + post_it.set_owner(self) reorder_areas("dropzone_content") reorder_areas("post_its_in_list") break diff --git a/src/logic-scenes/board/post-it.gd b/src/logic-scenes/board/post-it.gd index 108c00e..65520df 100644 --- a/src/logic-scenes/board/post-it.gd +++ b/src/logic-scenes/board/post-it.gd @@ -104,3 +104,6 @@ func is_postit_attached() -> bool: return true return false +func tween_transform_to(target: Vector2): + var transform_tween = create_tween() + transform_tween.tween_property(self, "position", target, 0.25)