documentation index ◦ reference manual ◦ function index
Function: | anim.State | (name, image, *atlist, **properties): |
This creates a state that can be used in an anim.SMAnimation.
name - A string giving the name of this state.
image - The displayable that is shown to the user while we are in (entering) this state. For convenience, this can also be a string or tuple, which is interpreted with Image.
image should be None when this State is used with motion, to indicate that the image will be replaced with the child of the motion.
atlist - A list of functions to call on the image. (In general, if something can be used in an at clause, it can be used here as well.)
If any keyword arguments are given, they are used to construct a Position object, that modifies the position of the image.
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") )