Skip to content

Frame

Module: terminaltexteffects.engine.animation

A Frame is a CharacterVisual with a duration.

Parameters:

Name Type Description Default
character_visual CharacterVisual

a CharacterVisual object

required
duration int

the number of ticks to display the Frame

required

Attributes:

Name Type Description
character_visual CharacterVisual

the CharacterVisual object for the Frame

duration int

the number of ticks to display the Frame

ticks_elapsed int

the number of ticks that have elapsed displaying this frame

Source code in terminaltexteffects/engine/animation.py
@dataclass
class Frame:
    """A Frame is a CharacterVisual with a duration.

    Args:
        character_visual (CharacterVisual): a CharacterVisual object
        duration (int): the number of ticks to display the Frame

    Attributes:
        character_visual (CharacterVisual): the CharacterVisual object for the Frame
        duration (int): the number of ticks to display the Frame
        ticks_elapsed (int): the number of ticks that have elapsed displaying this frame
    """

    character_visual: CharacterVisual
    duration: int

    def __post_init__(self):
        self.ticks_elapsed = 0