documentation indexreference manualfunction index

MoveTransition

Function: MoveTransition (delay, factory=None, enter_factory=None, leave_factory=None, old=False, layers=['master']):

This transition attempts to find images that have changed position, and moves them from the old position to the new transition, taking delay seconds to complete the move.

If factory is given, it is expected to be a function that takes as arguments: an old position, a new position, the delay, and a displayable, and to return a displayable as an argument. If not given, the default behavior is to move the displayable from the starting to the ending positions. Positions are always given as (xpos, ypos, xanchor, yanchor) tuples.

If enter_factory or leave_factory are given, they are expected to be functions that take as arguments a position, a delay, and a displayable, and return a displayable. They are applied to displayables that are entering or leaving the scene, respectively. The default is to show in place displayables that are entering, and not to show those that are leaving.

If old is True, then factory moves the old displayable with the given tag. Otherwise, it moves the new displayable with that tag. (new in 6.6.1)

layers is a list of layers that the transition will be applied to. (new in 6.9.0)

Images are considered to be the same if they have the same tag, in the same way that the tag is used to determine which image to replace or to hide. They are also considered to be the same if they are the same displayable.

If you use this transition to slide an image off the side of the screen, remember to hide it when you are done. (Or just use it with a leave_factory.)

There are several constructors that create functions for use with enter_factory and leave_factory:

Function: MoveFactory (**kwargs):

Can be used with factory to supply arguments to Move.

Function: MoveIn (pos, **kwargs):

Can be used with enter_factory to move in entering elements.

pos - An (xpos, ypos, xanchor, yanchor) tuple, giving the position to move from. Any component can be None, to take the corresponding component of the final position.

Keyword arguments are passed to Move.

Function: MoveOut (pos, **kwargs):

Can be used with leave_factory to move in entering elements.

pos - An (xpos, ypos, xanchor, yanchor) tuple, giving the position to move to. Any component can be None, to take the corresponding component of the original position.

Keyword arguments are passed to Move.

Function: ZoomInOut (start, end, **kwargs):

Can be used with enter_factory or leave_factory. Used to zoom in or out entering or leaving displayables.

start - The zoom factor at the start of the transition.

end - The zoom factor at the end of the transition.

Keyword arguments are passed to FactorZoom.

Function: RevolveInOut (start, end, **kwargs):

Can be used with enter_factory or leave_factory. Used to revolve in or out entering or leaving displayables.

start - The clockwise revolution at the start of the transition.

end - The clockwise revolution at the end of the transition.

Additional keyword arguments are passed to Revolve.

Example

init:
    $ move = MoveTransition(0.5)

e "The move transition moves around images that have
   changed position."

e "For example..."

show eileen happy at offscreenleft with move

e "I can move over to the offscreenleft position, just off
   the left side of the screen."

show eileen happy at left with move

e "The left position has my left side border the left
   margin of the screen."

show eileen happy at center with move

e "I can also move to the center..."

show eileen happy at right with move

e "... the right ..."

show eileen happy at offscreenright with move

e "... or even to offscreenright, off the right-hand side
   of the screen."

show eileen happy at right with move

e "We don't limit you to these five positions either. You
   can always create your own Position objects."

documentation indexreference manualfunction index