Skip to content

animation

FreeBodyEngine.graphics.animation #

Animation(name, frames, loop=True) dataclass #

A single named animation: its ordered frames and whether it loops back to the first frame after the last, or holds on it.

frames instance-attribute #

loop = True class-attribute instance-attribute #

name instance-attribute #

AnimationFrame(texture, duration) dataclass #

A single frame of an animation. texture may be a whole standalone image, or a Texture whose uv_rect has already been narrowed down to one cell of a spritesheet image.

duration instance-attribute #

texture instance-attribute #

AnimationPlayer(animation_set, default=None) #

Advances an AnimationSet's frames over time for a single sprite instance.

Starts playback of default (or, if omitted, whichever animation happens to be first in animation_set - dict insertion order, i.e. the order it was defined in the .fbanim file) at its first frame.

animation property #

The Animation currently playing.

animation_set = animation_set instance-attribute #

current_animation = default instance-attribute #

elapsed = 0.0 instance-attribute #

frame property #

The frame currently being displayed.

frame_index = 0 instance-attribute #

set_animation(name, restart=False) #

Switches playback to the animation named name. If it's already the current animation, this is a no-op unless restart is True, in which case playback jumps back to frame 0. Warns and does nothing if name doesn't exist in this player's AnimationSet.

update(dt) #

Advances playback by dt seconds. Returns True if the current frame changed.

AnimationSet(animations) #

The parsed contents of a .fbanim file: every named animation it defines.

Wraps an already-built name -> Animation mapping.

animations = animations instance-attribute #

get(name) #

Returns the Animation named name - raises KeyError if it isn't in this set.