PopochiuTransitionLayer
Inherits: Control
Description
Handles visual transitions between rooms, cutscenes, and other gameplay moments.
Supports many standard transitions (fade, wipe, tunnels, etc) as well as custom ones, with configurable duration and colors.
Methods
| Return Type | Method |
|---|---|
| int | add_custom_transition(anim: Animation, anim_name: String, overwrite: bool = false) |
| int | copy_image(texture_path: String) |
| Animation | create_basic_custom_transition(texture_path: String, cutoff: float, smoothing: float, duration: float, visibility_track = false, modulate_track = false, color: Color = PopochiuUtils.e.settings.tl_fade_color) |
| PackedStringArray | get_all_transitions_list() |
| AnimationLibrary | get_custom_library() |
| String | get_custom_name(anim_name: String) static |
| Animation | get_custom_transition(anim_name: String) |
| PackedStringArray | get_custom_transitions_list() |
| PackedStringArray | get_predefined_transitions_list() |
| String | get_simple_name(anim_name: String) static |
| Animation | get_transition(anim_name: String) |
| bool | has_color_override_track(anim_name: String) |
| bool | has_custom_library() |
| bool | has_custom_transition(anim_name: String) |
| void | hide_curtain() |
| bool | is_valid_name(anim_name: String) static |
| void | play_transition(anim_name: String = "fade", duration: float = 1.0, mode: int = PLAY_MODE.IN_OUT, color: Color = PopochiuUtils.e.settings.tl_fade_color) |
| void | remove_custom_transition(anim_name: String) |
| void | show_curtain(color: Color = PopochiuUtils.e.settings.tl_fade_color) |
| void | toggle_track(anim_name: String, track_name: String, value: bool) |
Signals
- transition_finished(transition_name: String)
Enumerations
Signal Descriptions
transition_finished
signal transition_finished(transition_name: String)
Emitted when a transition animation completes.
Enumeration Descriptions
enum PLAY_MODE
enum PLAY_MODE {
IN,
OUT,
IN_OUT,
}
Method Descriptions
add_custom_transition
func add_custom_transition(anim: Animation, anim_name: String, overwrite: bool = false) -> int
Create an animation resource and add that as a custom transition to the User animation library.
If overwrite is true, any existing animation with the same name will be overwritten.
Returns ResultCodes.SUCCESS or ResultCodes.ERR_ANIMATION_ALREADY_EXISTS.
copy_image
func copy_image(texture_path: String) -> int
Copy an image to the transition layer masks directory. Returns ResultCodes.SUCCESS or ResultCodes.FAILURE.
create_basic_custom_transition
func create_basic_custom_transition(texture_path: String, cutoff: float, smoothing: float, duration: float, visibility_track = false, modulate_track = false, color: Color = PopochiuUtils.e.settings.tl_fade_color) -> Animation
Create a basic custom transition and return it as an Animation resource.
The transition uses the texture specified by texture_path (path to the image file),
with the specified cutoff and smoothing values, lasting duration seconds.
If visibility_track is true, a visibility track will be added to the animation.
If modulate_track is true, a modulate track will be added to the animation, using the
specified color.
Returns the created Animation resource or null on failure.
get_all_transitions_list
func get_all_transitions_list() -> PackedStringArray
Returns a list of all transition names.
get_custom_library
func get_custom_library() -> AnimationLibrary
Returns the custom animation library or null.
get_custom_name
static func get_custom_name(anim_name: String) -> String
get_custom_transition
func get_custom_transition(anim_name: String) -> Animation
Returns the custom transition specified by anim_name.
Returns null if not found.
get_custom_transitions_list
func get_custom_transitions_list() -> PackedStringArray
Returns a list of all custom transition names.
get_predefined_transitions_list
func get_predefined_transitions_list() -> PackedStringArray
Returns a list of predefined transition names.
get_simple_name
static func get_simple_name(anim_name: String) -> String
get_transition
func get_transition(anim_name: String) -> Animation
Returns the animation specified by anim_name.
has_color_override_track
func has_color_override_track(anim_name: String) -> bool
Check if the transition specified by anim_name has an enabled track that overrides the
default Curtain color.
has_custom_library
func has_custom_library() -> bool
Returns true if an animation library with custom transition is present.
has_custom_transition
func has_custom_transition(anim_name: String) -> bool
Returns true if the custom transition specified by anim_name exists.
hide_curtain
func hide_curtain() -> void
Hides the transition layer.
is_valid_name
static func is_valid_name(anim_name: String) -> bool
Check if an animation name is valid according to is_valid_animation_name() in godot/scene/resources/animation_library.cpp
play_transition
func play_transition(anim_name: String = "fade", duration: float = 1.0, mode: int = PLAY_MODE.IN_OUT, color: Color = PopochiuUtils.e.settings.tl_fade_color) -> void
Plays a transition with the animation identified by anim_name, that lasts duration
(in seconds), with the specified mode showing the Curtain with the specified
color.
The Curtain color follows this precedence rule (from highest to lowest):
- color specified from code;
- color specified in the modulate track of the animation (if enabled);
- color specified in project settings.
Note: Custom transitions must use snake_case naming convention for proper
display in project settings. The name parameter accepts any format (Title Case,
CamelCase, or snake_case) and normalizes it internally.
remove_custom_transition
func remove_custom_transition(anim_name: String) -> void
Remove a custom transition from the User animation library.
show_curtain
func show_curtain(color: Color = PopochiuUtils.e.settings.tl_fade_color) -> void
Shows the curtain with the specified color without playing any transition.
if name is not specified, the curtain will be shown with the default color from project
settings. Beware that this color can be subsequently overridden by animation tracks or by code.
toggle_track
func toggle_track(anim_name: String, track_name: String, value: bool) -> void
Toggle a track specified by track_name of an animation specified by anim_name
on or off based on value.