How can I fade a Panel in 4.0?

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

in 3.0 I could use a AnimationPlayer to alter the modulate property to fade the PopupPanel in and out. But in 4.0 PopupPanel doesn’t have a modulate property. How can I do the fade.

Looks like CanvasItem had the modulate property, but 4.0 no longer inherits from that:
3.0 PopupPanel inheritance: Popup < Control < CanvasItem < Node < Object
4.0 PopupPanel inheritance: Popup < Window < Viewport < Node < Object

If it’s no longer possible, what is a good replacement?

:bust_in_silhouette: Reply From: honeycoffee

I would just make it a child of a node that has “modulate” and animate that

:bust_in_silhouette: Reply From: rakkarage

Or tween color (property name) of ColorRect:

extends Control

const _duration = 1.0
const _delay0 = 0.5
const _delay1 = 1.5
const _delay2 = 0.8

@onready var _back:    = $Back
@onready var _texture: = $Texture
@onready var _fore:    = $Fore
@onready var _audio:   = $Audio
var _tween: Tween

func _ready() -> void:
	_tween = create_tween()
	_tween.tween_property(_back, "color", Color.BLACK, _duration)
	_tween.parallel().tween_property(_texture, "rotation", PI, _duration)
	_tween.parallel().tween_property(_texture, "scale", Vector2.ONE * 3, _duration)
	_tween.chain().tween_property(_fore, "color", Color.BLACK, _duration).set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_IN_OUT).set_delay(_delay1)
	var timer := get_tree().create_timer(_delay2)
	await timer.timeout

func _input(event: InputEvent) -> void:
	if event is InputEventMouseButton and not event.pressed:

func _unhandled_key_input(_event: InputEvent) -> void:

func _done() -> void: