Animation Controllers

Complex AnimationsAnimation FrameworkEasing Functions

In this document

As of now there are two animation controller class provided.

  • Repeat
  • Delay

Repeat

Repeat as the name says, is used to repeats all simple or even complex delta animations. It provides a simple interface for repeating animations. Lets take an example.

from pymt import *

win = MTWindow()
widget = MTScatterWidget()
win.add_widget(widget)

anim1 = Animation(duration=1, center=(100,100) type='delta')
anim2 = Animation(duration=1, rotation=45 type='delta')

anim = anim1 + anim2

repeat_anim = Repeat(anim, times=5)  #repeats 5 times
repeat_infy = Repeat(anim)  #repeats indefinitely

widget.do(repeat_anim)

runTouchApp()

The widget first moves by (100,100) then it rotates by 45 degrees, then it repeats this process 5 times. If we had used repeat_infy animation, the process would repeat indefinitely. As we can see from above example, times parameter determines how many times the Repetition should take place, if we don't specify, it repeats infinitely by default.

Delay

This class to add some delay to a particular animation. You just pass the duration for which you want to delay an animation and then sequence it with the animation you want to delay using the '+' symbol. Lets take an example

from pymt import *

win = MTWindow()
widget = MTScatterWidget()
win.add_widget(widget)

anim = Animation(duration = 1, center = (100,100) type = 'delta')
delay5 = Delay(duration = 5)
delayed_anim = delay5+anim

widget.do(delayed_anim)

runTouchApp()

This will start executing the animation after 5 secs.