All Projects → backwardspy → transit

backwardspy / transit

Licence: MIT License
A simple Godot asset for smooth scene transitions.

Programming Languages

GDScript
375 projects

Projects that are alternatives of or similar to transit

broken seals
An open source third person action RPG with multiplayer support.
Stars: ✭ 223 (+913.64%)
Mutual labels:  godot
godot card tools
Framework for making card-games in Godot
Stars: ✭ 30 (+36.36%)
Mutual labels:  godot
godot experiments
Some 2D, 3D & VR experiments and tutorials in Godot 3
Stars: ✭ 181 (+722.73%)
Mutual labels:  godot
GodotDiscordSDK
A Discord Game SDK wrapper for Godot, written in C.
Stars: ✭ 40 (+81.82%)
Mutual labels:  godot
BrainfuckIDE
A Brainfuck IDE/debugger designed to be intuitive, featureful and visually appealing
Stars: ✭ 77 (+250%)
Mutual labels:  godot
GodotRecorder
A simple addon to record frames of in-game footage.
Stars: ✭ 47 (+113.64%)
Mutual labels:  godot
line-renderer
A GDScript implementation of a line renderer in Godot.
Stars: ✭ 25 (+13.64%)
Mutual labels:  godot
LinuxLikeConsole
Linux Like Console written in gdscript for Godot (Game Engine)
Stars: ✭ 26 (+18.18%)
Mutual labels:  godot
godot-polygon2d-fracture
A simple script for fracturing polygons. Also adds nice helper functions for polygons like calculateArea, triangulate, getRandomPointsInPolygon, getBoundingRect)
Stars: ✭ 148 (+572.73%)
Mutual labels:  godot
godot openhmd
OpenHMD GDNative driver for Godot
Stars: ✭ 34 (+54.55%)
Mutual labels:  godot
godot-tester
A Github Action to handle testing Godot applications with GUT
Stars: ✭ 15 (-31.82%)
Mutual labels:  godot
discord.gd
Discord Bot API wrapper for Godot. Make bots in GDScript.
Stars: ✭ 69 (+213.64%)
Mutual labels:  godot
godot parser
Python library for parsing Godot scene files
Stars: ✭ 27 (+22.73%)
Mutual labels:  godot
Fake-Interior-Shader-for-GodotEngine
Interior Mapping shader for the Godot Game Engine 3.x that works with both GLES3 and GLES2.
Stars: ✭ 40 (+81.82%)
Mutual labels:  godot
angular-super-gallery
AngularJS super image gallery
Stars: ✭ 46 (+109.09%)
Mutual labels:  transitions
Godot-Share
Simple share text and/or image module for Godot Engine (Android & iOS)
Stars: ✭ 58 (+163.64%)
Mutual labels:  godot
godot-twicil
Godot TwiCIL – Godot Twitch Chat Interaction Layer
Stars: ✭ 57 (+159.09%)
Mutual labels:  godot
space
A SCI-FI community game server simulating space(ships). Built from the ground up to support moddable online action multiplayer and roleplay!
Stars: ✭ 25 (+13.64%)
Mutual labels:  godot
Texture-Fonts
Godot Plugin for creating custom Fonts from Textures
Stars: ✭ 59 (+168.18%)
Mutual labels:  godot
geodot-plugin
Godot plugin for loading geospatial data
Stars: ✭ 37 (+68.18%)
Mutual labels:  godot

Transit

Transit on the Godot Asset Library

A simple Godot asset for smooth scene transitions.

GIF showing Transit in action

Usage

Add Transit to your project via the AssetLib tab in Godot. I highly recommend deselecting everything but the transit folder when first installing Transit.

Image showing the package installer with only transit selected

Once Transit is installed, add Transit.tscn to your project's AutoLoad list in the project settings.

GIF showing how to add Transit to a project's AutoLoad list

Important: Make sure you add the scene file (ending in .tscn) to the AutoLoad list. Adding the GDScript file (ending in .gd) will not work.

Now you can call Transit.change_scene in your scripts to change scenes in much the same way you would with SceneTree.change_scene. For example:

func on_button_pressed():
    Transit.change_scene("res://Game.tscn")

Documentation

Change Scene

change_scene(path: String, duration: Float = 0.2, delay: float = 0)

Fades out, calls get_tree().change_scene(path), then fades back in. Emits the scene_changed signal once the transition is completed.

Parameters:

  • path: The scene to change to after fading out.
  • duration: How long in seconds the fade should last on each side of the transition. Defaults to 0.2s (200ms).
  • delay: How long to wait before starting the transition. Defaults to 0s, i.e no delay.

Example:

# A simple fade transition to `Game.tscn`.
Transit.change_scene("res://Game.tscn")

# Then same as above, except each fade (out and in) takes half a second.
Transit.change_scene("res://Game.tscn", 0.5)

# The same as above, except now it waits for a full second before fading out.
Transit.change_scene("res://Game.tscn", 0.5, 1.0)

Set fade-to color

set_color(color: Color)

Sets the intermediate color to use when fading between scenes. The default is black. This function preserves the current alpha value, which means it's safe to change colours even while a fade is in progress.

Parameters:

  • color: The color to fade to. This is implemented as a ColorRect that exists on the highest canvas layer in the scene.

Example:

# Set fade color to white.
Transit.set_color(Color.white)

# This will now fade to white before changing to `Game.tscn`
Transit.change_scene("res://Game.tscn")

Implementation Details

Transit works by creating a ColorRect on canvas layer #128 (the highest.) This ColorRect defaults to black with 0 alpha, with mouse filtering set to MOUSE_FILTER_IGNORE. When change_scene is called, the following process happens:

  1. The ColorRect mouse filtering is set to MOUSE_FILTER_STOP to prevent further UI interaction.
  2. If delay is larger than 0, the function yields for that amount of time.
  3. An animation is played that fades the alpha value to 1 over the given time period.
  4. SceneTree.change_scene is invoked on the current tree, changing to the requested scene.
  5. The ColorRect mouse filtering is set back to MOUSE_FILTER_IGNORE to allow UI interactions.
  6. The same fade animation as before is played in reverse to fade the ColorRect alpha back to 0.
  7. The scene_changed signal is emitted.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].