Animation package: handle animation with ease in PyMT
This is an Animation Framework, using which you can animate any property of an object over a provided duration. You can even animate CSS property.
Example of a widget
widget = SomeWidget()
animobj = Animation(duration=5,x=100,
style={'bg-color':(1.0,1.0,1.0,1.0)})
widget.do (animobj)
You create a animation class object and pass the object into the widget that you would like to animate, the object will be animated from its current state to the state specified in the animation object.
You can also use animate() method of the Animation class to animate the widget
animobj.animate(widget)
You can also pass multiple widgets, to animate the same way
# solution 1
animobj.animate(widget1, widget2)
# solution 2
widget1.do(animobj)
widget2.do(animobj)
You can sequence several animations together
anim1 = Animation(duration=1, x=100)
anim2 = Animation(duration=2, y = 200)
anim3 = Animation(duration=1, rotation = 60)
anim_xyrot = anim1 + anim2 + anim3
widget.do(anim_xyrot)
This is execute the animations sequentially, “+” is used to execute them sequentially. First the widget will move to x=100 in 1 sec then it will move to y=200 in secs and finally rotate clockwise 60 Degress in 1 sec.
You can also run several animations parallel
anim1 = Animation(duration=1, x=100)
anim2 = Animation(duration=2, y = 200)
anim3 = Animation(duration=1, rotation = 60)
anim_xyrot = anim1 & anim2 & anim3
widget.do(anim_xyrot)
This will execute all the animations on the properties togather. “&” operator is used to run them parallel
Bases: object
Collection of animation function, to be used with Animation object. Easing Functions ported into PyMT from Clutter Project http://www.clutter-project.org/docs/clutter/stable/ClutterAlpha.html
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_back
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_bounce
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_circ
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_cubic
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_elastic
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_expo
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_out_back
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_out_bounce
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_out_circ
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_out_cubic
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_out_elastic
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_out_expo
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_out_quad
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_out_quart
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_out_quint
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_out_sine
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_quad
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_quart
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_quint
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_in_sine
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_out_back
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_out_bounce
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_out_circ
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_out_cubic
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_out_elastic
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_out_expo
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_out_quad
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_out_quart
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_out_quint
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#ease_out_sine
See documentation at http://pymt.eu/wiki/DevGuide/EasingFunctions#linear
Bases: pymt.event.EventDispatcher
Animation Class is used to animate any widget. You pass duration of animation and the property that has to be animated in that duration.
Usage
widget = SomeWidget()
animobj = Animation(duration=5, x=100,
style={'bg-color':(1.0,1.0,1.0,1.0)})
widget.do(animobj)
| Parameters : |
|
|---|---|
| Events : |
|
Animate the widgets specified as parameters to this method.
| Parameters : |
|
|---|
Calls AnimationBase objects reset function.
Creates a new animationBase object and sets the widget to it for animation. This is a internal function and should not be used by user.
| Parameters : |
|
|---|
Starts animating the widget. This function should not be used by the user directly. Users have to use do() method of the widget to animate.
Stops animating the widget and raises a event.
Bases: pymt.event.EventDispatcher
Repeat Controller class is used to repeat a particular animations. It repeats n times as specified or repeats indefinately if number of times to repeat is not specified. Repeat class is useful only for delta animations.
Usage
widget = SomeWidget()
animobj = Animation(duration=5, x=100,
style={'bg-color':(1.0,1.0,1.0,1.0)})
rept = Repeat(animobj, times=5) #Repeats 5 times
rept_n = Repeat(animobj) #Repeats indefinately
| Parameters : |
|
|---|---|
| Events : |
|
Internal function used by the Repeat controller to check for repetitions
Called by the widget to set the widget which has to be animated
Starts the animation
Stops the animation
Bases: pymt.ui.animation.Animation
Delay class is used to introduce delay in your animations. You can provide the duration in your animation class creation
Usage
widget = SomeWidget()
moveX = Animation(duration=5, x=100,
style={'bg-color':(1.0,1.0,1.0,1.0)})
delay5 = Delay(duration=5)
animobj = delay5 + moveX
# This will wait for 5 secs and then start animating moveX
| Parameters : |
|
|---|