Sprite frame library for AnimatedSprite2D and AnimatedSprite3D.
Sprite frame library for an AnimatedSprite2D or AnimatedSprite3D node. Contains frames and animation data for playback.
Adds a frame to the anim animation. If at_position is -1, the frame will be added to the end of the animation. duration specifies the relative duration, see get_frame_duration() for details.
Duplicates the animation anim_from to a new animation named anim_to. Fails if anim_to already exists, or if anim_from does not exist.
Returns an array containing the names associated to each animation. Values are placed in alphabetical order.
Returns a relative duration of the frame idx in the anim animation (defaults to 1.0). For example, a frame with a duration of 2.0 is displayed twice as long as a frame with a duration of 1.0. You can calculate the absolute duration (in seconds) of a frame using the following formula:
absolute_duration = relative_duration / (animation_fps * abs(playing_speed))In this example, playing_speed refers to either AnimatedSprite2D.get_playing_speed() or AnimatedSprite3D.get_playing_speed().
If loop is false equivalent to set_animation_loop_mode(LOOP_NONE).
If loop is true equivalent to set_animation_loop_mode(LOOP_LINEAR).
Sets the texture and the duration of the frame idx in the anim animation. duration specifies the relative duration, see get_frame_duration() for details.
LOOP_NONE = 0The animation plays once and stops when it reaches the end, or the start if played in reverse.
LOOP_LINEAR = 1The animation restarts from the beginning when it reaches the end, or from the end if played in reverse, repeating continuously.
LOOP_PINGPONG = 2The animation alternates direction each time it reaches the end or start, playing forward and then in reverse repeatedly.
Note: Both AnimatedSprite2D and AnimatedSprite3D play the first/last frame for its duration only once at each end of the animation loop (instead of twice, once per forward/backward animation direction).