How to change a scene with a fadin?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Syl

Hello, could someone tells me how to start a fadin animation of my background triggered from that script, and changin scene with the fadin?

extends Node2D

func ready():
set_process_input(true)
func _input(event):
if event is InputEventMouseButton and event.pressed and event.button_index == 1:
get_tree().change_scene(“res://Scenes/chaos.tscn”)

:bust_in_silhouette: Reply From: Socrates

There are probably a very large number of ways to do this but one way would be to attach an animation player to the scene and animate the modulate property to achieve the effect you want. You could probably just set that animation to autoload and it would run whenever you enter the scene.

Thxs, but actually I would like to have it started when the background is clicked, to change scene smoothly. Where’s the modulate property?

And where one would learn to make fadin animation? Followed the godot animation course, but noth about it.

Syl | 2018-02-27 03:35

For the effect you want, you need to have both scenes active for the transition. Stack them in a third “manager” scene and animate them both. There are enough tutorials on Youtube and posts where you can find out how animation is done. Also, you should read the documentation.

Footurist | 2018-02-27 04:12

Can’t I simply script the start of the anim at a click on background, runin its fade effect, and then change to the other scene?

And thxs, but there might be too much docs, cause I cannot find one about fadin animation…

Syl | 2018-02-27 05:27

You won’t find such a documentation, because a fade in is simply a change of the alpha cannel of the modulate of an object, which you can basically understand as color. So, to fade something you make an animation of the alpha channel. I advise you to watch some of the Youtube tutorials about animation.

Footurist | 2018-02-27 16:32

Ok, solved it, thxs!

Syl | 2018-02-27 16:38