AnimationPlayer scale vs scale by code

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

I’m having problems in get correct size for my nodes.
I’m instancing random nodes that on appearing do a AnimationPlayer which track is an scale transform from 3 to 1.5,

Its final size should depend of a randi number of items, so by code I multiply this node scale by a factor once known number of items.
In the very moment I use the animation, scale doesn’t work and node has always in screen same size, even if scale printed value is different and apparentely correct.
Any idea of how to do it?

	if !$Frutas/AnimationPlayer.is_playing():
	$Frutas/AnimationPlayer.play("Zoom") #final scale value from track=1.5
print($Frutas.scale) # 1.5 as it should be
if numero==2:
	$Frutas.scale=1.8*$Frutas.scale
elif numero>3:
	$Frutas.scale=0.8*$Frutas.scale
print("La escala es: ", $Frutas.scale) #1.2, 2.7, etc. supposely correct

But nodes have always same size in screen. Only changes correctly if I disable animation.

:bust_in_silhouette: Reply From: exuin

I think you’re using the wrong node. AnimationPlayer is for fixed animations. No matter what you set the scale to, the AnimationPlayer will override it with a fixed value. Use a Tween node instead since those are for dynamic animations.

Hey! I’ve been trying to make moving platforms with the animation player, and for some reason it keeps overriding the scale for the tilemap that I’m moving. This isn’t as related to this original post, but how could I change the value it defaults the scale to? This frustrates me to no end as I can’t fix it at all

Hi it’s exuin again

Animation tracks have a RESET track that is called by default when the scene opens, would changing the value there work?