gale.animation module

This file contains the implementation of the class Animation: steps through a sequence of frames at a fixed time interval, with an optional loop count.

Author: Alejandro Mujica (aledrums@gmail.com)

class gale.animation.Animation(frames, time_interval=0, loops=None, on_finish=None)[source]

Bases: object

This class represents animations as a sequence of frames. Those frames change in a given time interval.

Parameters:
  • frames (Sequence[Any])

  • time_interval (float)

  • loops (int | None)

  • on_finish (Callable[[], None] | None)

reset()[source]

Set the animation on its initial values.

Return type:

None

update(dt)[source]

This function updates the animation timer to check whether the frame should be changed or not. If the animation has only one frame or it has executed the number of times defined by loops, then this operation does not execute.

Parameters:

dt (float)

Return type:

None

get_current_frame()[source]
Returns:

The current frame of the animation.

Return type:

Any