documentation index ◦ reference manual ◦ function index

# anim.SMAnimation

Function: | anim.SMAnimation | (initial, *args, **properties):

This creates a state-machine animation. Such an animation is created by randomly traversing the edges between states in a defined state machine. Each state corresponds to an image shown to the user, with the edges corresponding to the amount of time an image is shown, and the transition it is shown with.

Images are shown, perhaps with a transition, when we are transitioning into a state containing that image.

initial - The name (a string) of the initial state we start in.

showold - If the keyword parameter showold is True, then the old image is shown instead of the new image when in an edge.

anim_timebase - If True, we use the animation timebase. If False, we use the displayable timebase.

This accepts as additional arguments the anim.State and anim.Edge objects that are used to make up this state machine.

## Example

    init:
        image blinking = anim.SMAnimation("a",
            anim.State("a", "eyes_open.png"),

            # This edge keeps us showing the eyes open for a second.
            anim.Edge("a", 1.0, "a", prob=60),

            # This edge causes the eyes to start closing...
            anim.Edge("a", 0.25, "b"),

            # ..because it brings us here.
            anim.State("b", "eyes_half.png"),

            # And so on...
            anim.Edge("b", 0.25, "c"),
            anim.State("c", "eyes_closed.png"),
            anim.Edge("c", 0.25, "d"),
            anim.State("d", "eyes_half.png"),

            # And back to a.
            anim.Edge("d", 0.5, "a")
            )

documentation index ◦ reference manual ◦ function index