How to alter the parameters of animations loaded into the SpriteFrames window

Godot Version

4.2.1

Question

I have several animations loaded as SpriteFrames, let call them walk, run, fly
Is it possible to alter the parameters of each animation set without affecting the others.

Is it possible to alter the scale of only walk to be 1.5, either via the inspector or in code?

Or would each animation set have to have its own AnimatedSprite2D node?

can’t you call the SpriteFrame attribute directly from the node itself and then check the currently running animation?

I believe somewhere in your code you must have a line that says animationSprite2d.play("walk"). Can’t you set the scale right after it?

I found that I had to use Vector2 - this a a very small piece of the code but the line to scale is:

		tank_anim.scale = Vector2(2,2)

You can modify the SpriteFrames Resource at runtime via code but take into account that Resources are shared by default so if you modify one animation it will modify all other sprites that share the same SpriteFrames resource. You’ll need to make them unique before modifying it:

  • Enable Local to Scene in the Resource. This will make unique the resource when instantiating the scene (if the resource is shared between nodes in the same scene the copies won’t be made unique)
  • Calling Resource.duplicate() in code. Do that before modifying the resource. Something like: sprite2d.sprite_frames = sprite2d.sprite_frames.duplicate()