Animations In The Same Time In Kivy
I am coding a simple optical illusion app to learn how to code in Kivy. I would like to know why my program crashes and how to solve it. If I uncomment the animation.start(self.c4)
Solution 1:
I think the problem might be with recreating new Animation
with each call of on_complete
functions.
Try to use repeat animation property.
def__init__(self, **kwargs):
super(Illusion, self).__init__(**kwargs)
objects = (self.c1, self.c2, self.c3, self.c4)
values = (0,1,0,0)
for i, item inenumerate(objects):
objects[i].v = values[i]
self.animation_v0 = Animation(v = 0, d = .25) + Animation(v = 1, d = .25)
self.animation_v0.repeat = True
self.animation_v1 = Animation(v = 1, d = .25) + Animation(v = 0, d = .25)
self.animation_v1.repeat = True#self.animation_v0.bind(on_complete=self.start_illusion)#self.animation_v1.bind(on_complete=self.continue_illusion)
self.animation_v0.start(self.c3)
self.animation_v1.start(self.c4)
defstart_illusion(self, instance, value):
self.animation_v0.start(self.c3)
defcontinue_illusion(self, instance, value):
self.animation_v1.start(self.c4)
Post a Comment for "Animations In The Same Time In Kivy"