Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
How to use Animation.completion or Animation.finished
-
I am having some success and enjoying using Animation on layers, however i am stuck on how to use Animation completion or Animation.finished
It would really help me if someone could add an example of the usage of both on the code below (example from the docs)
from scene import * import sys class MyScene (Scene): def setup(self): self.layer = Layer(Rect(self.size.w * 0.5 - 100, self.size.h * 0.5 - 100, 200, 200)) self.layer.background = Color(1, 0, 0) self.layer.animate('alpha', 0.0, duration=1.0, autoreverse=True, repeat=sys.maxint) def draw(self): background(0, 0, 0) self.layer.update(self.dt) self.layer.draw() run(MyScene())
From the docs:
Animation.completion A function (without parameters) that gets called when the animation completes. Animation.finished Gets set to True when the animation finishes.
Thanks for your help !
-
See: http://omz-forums.appspot.com/pythonista/post/5910507735220224 for an example of completion.
-
Thanks, good pointer. I would not have figured it out in a million years.
However i think i must be missing something, from what i read in the doc:
Animation.completion A function (without parameters) that gets called when the animation completes.
However if i understand the example well the completion function that gets called is counterclockwise which has a parameter called completion?
def counterclockwise(completion=None):What am I missing? Is the parameter simply ignored?
Thx