Complex Animations
| Types of Animations | Animation Framework | Controllers |
In this document
Often in user interfaces and real-time graphics there is need for complex animations, like sequencing a set of transformations or running parallel several animations. PyMT provides provision for such animations too, plus we have a very simple structure to make the magic happen. You can either use absolute or delta animations in these.
Sequenced Animations
from pymt import *
win = MTWindow()
widget = MTRectangularWidget()
win.add_widget(widget)
anim1 = Animation(duration=1, x=100)
anim2 = Animation(duration=2, y = 200)
anim3 = Animation(duration=1, rotation = 60)
anim_xyrot = anim1 + anim2 + anim3 #Sequencing
widget.do(anim_xyrot)
runTouchApp()
win = MTWindow()
widget = MTRectangularWidget()
win.add_widget(widget)
anim1 = Animation(duration=1, x=100)
anim2 = Animation(duration=2, y = 200)
anim3 = Animation(duration=1, rotation = 60)
anim_xyrot = anim1 + anim2 + anim3 #Sequencing
widget.do(anim_xyrot)
runTouchApp()
As we can see, we use + symbol to sequence several animations togather. In the above example the widget will first move to x=100 in 1 second, then it will move to y=200 in 2 seconds and finally it will rotate 60 degrees in 1 second. Its as simple as that!
Parallel Animations
from pymt import *
win = MTWindow()
widget = MTRectangularWidget()
win.add_widget(widget)
anim1 = Animation(duration=1, x=100)
anim2 = Animation(duration=2, y = 200)
anim3 = Animation(duration=1, rotation = 60)
anim_xyrot = anim1 & anim2 & anim3 #Parallel
widget.do(anim_xyrot)
runTouchApp()
win = MTWindow()
widget = MTRectangularWidget()
win.add_widget(widget)
anim1 = Animation(duration=1, x=100)
anim2 = Animation(duration=2, y = 200)
anim3 = Animation(duration=1, rotation = 60)
anim_xyrot = anim1 & anim2 & anim3 #Parallel
widget.do(anim_xyrot)
runTouchApp()
We use & symbol to run different animations simultaneously.
