Skip to content

Add a transition effect test scene#2237

Merged
manuq merged 1 commit into
mainfrom
wjt/add-a-transition-effect-test-scene
May 21, 2026
Merged

Add a transition effect test scene#2237
manuq merged 1 commit into
mainfrom
wjt/add-a-transition-effect-test-scene

Conversation

@wjt
Copy link
Copy Markdown
Member

@wjt wjt commented May 21, 2026

I find the labels for these effects counter-intuitive, and having
written this test tool I understand why.

@wjt wjt requested a review from a team as a code owner May 21, 2026 20:06
@wjt
Copy link
Copy Markdown
Member Author

wjt commented May 21, 2026

Try setting both to LEFT_TO_RIGHT_WIPE. I think the in-effect is as expected but the out-effect is inverted from what I would expect.

I find the labels for these effects counter-intuitive, and having
written this test tool I understand why.
@wjt wjt force-pushed the wjt/add-a-transition-effect-test-scene branch from 6c94221 to d1ea29e Compare May 21, 2026 20:08
@github-actions
Copy link
Copy Markdown

Play this branch at https://play.threadbare.game/branches/endlessm/wjt/add-a-transition-effect-test-scene/.

(This launches the game from the start, not directly at the change(s) in this pull request.)

@wjt
Copy link
Copy Markdown
Member Author

wjt commented May 21, 2026

Effectively we have to invert the sense of the transition on the way out (but not the way in!) for it to match the label.

This would do it:

diff --git a/scenes/globals/scene_switcher/transitions/transitions.gd b/scenes/globals/scene_switcher/transitions/transitions.gd
index 5bf48b78f..1564049c1 100644
--- a/scenes/globals/scene_switcher/transitions/transitions.gd
+++ b/scenes/globals/scene_switcher/transitions/transitions.gd
@@ -24,6 +29,19 @@ var _current_tween: Tween
 @onready var transition_mask: ColorRect = $TransitionMask
 
 
+static func _invert(effect: Effect) -> Effect:
+	match effect:
+		Effect.LEFT_TO_RIGHT_WIPE:
+			return Effect.RIGHT_TO_LEFT_WIPE
+		Effect.RIGHT_TO_LEFT_WIPE:
+			return Effect.LEFT_TO_RIGHT_WIPE
+		Effect.TOP_TO_BOTTOM_WIPE:
+			return Effect.BOTTOM_TO_TOP_WIPE
+		Effect.BOTTOM_TO_TOP_WIPE:
+			return Effect.TOP_TO_BOTTOM_WIPE
+		_:
+			return effect
+
 func _input(_event: InputEvent) -> void:
 	if visible:
 		get_viewport().set_input_as_handled()
@@ -64,21 +82,21 @@ func _do_tween(
 
 
 func _leave_scene(
-	_transition_effect: Effect = Effect.FADE,
+	transition_effect: Effect = Effect.FADE,
 	duration: float = 1.0,
 	easing: Tween.EaseType = Tween.EaseType.EASE_OUT,
 	transition_type: Tween.TransitionType = Tween.TransitionType.TRANS_QUAD
 ) -> void:
-	await _do_tween(0.0, _transition_effect, duration, easing, transition_type)
+	await _do_tween(0.0, _invert(transition_effect), duration, easing, transition_type)
 
 
 func _introduce_scene(
-	_transition_effect: Effect = Effect.FADE,
+	transition_effect: Effect = Effect.FADE,
 	duration: float = 1.0,
 	easing: Tween.EaseType = Tween.EaseType.EASE_IN,
 	transition_type: Tween.TransitionType = Tween.TransitionType.TRANS_QUAD
 ) -> void:
-	await _do_tween(1.0, _transition_effect, duration, easing, transition_type)
+	await _do_tween(1.0, transition_effect, duration, easing, transition_type)
 
 
 func do_transition(

@wjt
Copy link
Copy Markdown
Member Author

wjt commented May 21, 2026

@manuq
Copy link
Copy Markdown
Collaborator

manuq commented May 21, 2026

@manuq manuq merged commit c12eb2b into main May 21, 2026
7 checks passed
@manuq manuq deleted the wjt/add-a-transition-effect-test-scene branch May 21, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants