|
@@ -8,15 +8,16 @@ signal ended
|
|
|
@export_group("Tween caracteristics", "tween_")
|
|
|
@export var tween_is_parallel: bool = false
|
|
|
|
|
|
-@export_group("Step backward", "back_")
|
|
|
-@export var back_zoom_multiplier: float = 0.8
|
|
|
-@export var back_duration: float = 1.0
|
|
|
-
|
|
|
-@export_group("Move focus", "move_")
|
|
|
+@export_group("Move", "move_")
|
|
|
@export var move_duration: float = 1.0
|
|
|
+@export var move_trans: Tween.TransitionType = Tween.TRANS_SINE
|
|
|
+@export var move_ease: Tween.EaseType = Tween.EASE_IN_OUT
|
|
|
|
|
|
-@export_group("Step inward", "in_")
|
|
|
-@export var in_duration: float = 1.0
|
|
|
+@export_group("Zoom", "zoom_")
|
|
|
+@export var zoom_duration: float = 1.0
|
|
|
+@export var zoom_trans: Tween.TransitionType = Tween.TRANS_SINE
|
|
|
+@export var zoom_closer_ease: Tween.EaseType = Tween.EASE_IN
|
|
|
+@export var zoom_wider_ease: Tween.EaseType = Tween.EASE_OUT
|
|
|
|
|
|
var tween: Tween
|
|
|
|
|
@@ -26,12 +27,13 @@ func focus_on(pos: Vector2, scope: float) -> void:
|
|
|
tween.kill()
|
|
|
|
|
|
var target_zoom = Vector2.ONE / scope
|
|
|
- var min_zoom = target_zoom if target_zoom.x < get_zoom().x else get_zoom()
|
|
|
+ var is_wider = target_zoom.x < get_zoom().x
|
|
|
+ var min_zoom = target_zoom if is_wider else get_zoom()
|
|
|
+ var zoom_ease = zoom_wider_ease if is_wider else zoom_closer_ease
|
|
|
|
|
|
tween = create_tween().set_parallel(tween_is_parallel)
|
|
|
- tween.tween_property(self, "zoom", min_zoom * back_zoom_multiplier, back_duration)
|
|
|
- tween.tween_property(self, "position", pos, move_duration)
|
|
|
- tween.tween_property(self, "zoom", target_zoom, in_duration)
|
|
|
+ tween.tween_property(self, "position", pos, move_duration).set_trans(move_trans).set_ease(move_ease)
|
|
|
+ tween.tween_property(self, "zoom", target_zoom, zoom_duration).set_trans(zoom_trans).set_ease(zoom_ease)
|
|
|
tween.tween_callback(end)
|
|
|
|
|
|
|