documentation index ◦ reference manual ◦ function index
Function: | anim.Edge | (old, delay, new, trans=None, prob=1): |
This creates an edge that can be used with a anim.SMAnimation.
old - The name (a string) of the state that this transition is from.
delay - The number of seconds that this transition takes.
new - The name (a string) of the state that this transition is to.
trans - The transition that will be used to show the image found in the new state. If None, the image is show immediately.
prob - The number of times this edge is added. This can be used to make a transition more probable then others. For example, if one transition out of a state has prob=5, and the other has prob=1, then the one with prob=5 will execute 5/6 of the time, while the one with prob=1 will only occur 1/6 of the time. (Don't make this too large, as memory use is proportional to this value.)
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") )