Tweening Animated Sprite to have a colour gradiant

Godot Version

v4.6.2.stable.mono.official [71f334935]

Question

Hello! I hope this is the right spot. I have looked into the tween doc but can’t seem to get the animation to work.

My intention is that when a player clicks “new game”, it pans down and the art for the title changes from black to white. The panning scene works by an animation player node, but I can’t get the animatedsprite node that is the title art to change. (I have tried with an animationplayer alpha and clip but that did not work the way I wanted it to).

func _on_new_game_pressed():
print(“new game pressed”)
$mmbg/AnimationPlayer.play(“mainmenubg”)
create_tween().tween_property($CenterContainer/ColorRect/title, “modulate”, Color.WHITE, 4.0)
mmoptions.visible = !mmoptions.visible

Tweens animate from the property’s current value to the target. I’m pretty sure modulate defaults to Color.WHITE (1,1,1,1), so tweening to Color.WHITE does nothing visible - you’re tweening white → white

The original sprite is black, would that effect anything in this situation?

The sprite itself is black? Modulate will multiply the colors, a black sprite represents a value of zero, sounds like you are multiplying zero by one and getting zero.

Yes, the sprite is a simple black graphic.
How would you advise I make it so it can transition from being it’s original colour (black) to becoming white?

Make the texture white, then use modulate to make it black

Thank you all for taking the time with suggestions.
I could not get your idea to work, but I was inspired by your route.
Duplicated the sprite, made one white and the other black. Used an animation player channel to reduce the opacity of the black one.
Thank you again : )