Find how many frames an animation has from code

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

Hello

I imagine this is quite easy but does anyone know how I can check how many frames are in a given animation?

I am thinking something like

$AnimatedSprite.Length_Animation(“Default”)

but despite looking in the documentation for animated sprite I cannot see a way to know what the number of animation frames are in a given animation.

:bust_in_silhouette: Reply From: horsecar123

var passs=true
func _process(delta):
if passs:
memory=$AnimatedSprite.frame
$AnimatedSprite.frame=100#this value should above your how many frames you have
var max_frame_index=$AnimatedSprite.frame
print(max_frame_index)
$AnimatedSprite.frame=memory
passs=false