Add a transition effect test scene#2237
Merged
Merged
Conversation
Member
Author
|
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.
6c94221 to
d1ea29e
Compare
|
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.) |
Member
Author
|
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( |
Collaborator
|
This is amazing! With sound effects even :) Yes I agree, is all inverted. |
manuq
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I find the labels for these effects counter-intuitive, and having
written this test tool I understand why.