is there like a tutorial for that? just a black fade in, nothing much

  • xyz replied to this.

    Here's a similar example (Godot 4), where transition is a Sprite2D, and its modulate property's alpha channel is tweened from 1.0 to 0.0 over half a second.

    var tween: Tween = create_tween()
    tween.tween_property(transition, "modulate:a", 0.0, 0.5).from(1.0)
    await tween.finished

    If combining both tips above, here is the code that darkens the screen and terminates the program in a second and a half:

    # Exit by ESC.
    	if event is InputEventKey:
    		if event.pressed and event.keycode == KEY_ESCAPE:
    			var screen_size
    			screen_size = get_viewport_rect().size
    			$ColorRect.size = screen_size
    			$ColorRect.show()
    			var tween: Tween = create_tween()
    			tween.tween_property($ColorRect, "modulate:a", 1.0, 1.5).from(0.0)
    			await tween.finished
    			get_tree().quit()