Skip to content

Instantly share code, notes, and snippets.

@gottadiveintopython
Created October 8, 2018 00:53
Show Gist options
  • Save gottadiveintopython/7605ac5e2d0eaebbc68f124619717087 to your computer and use it in GitHub Desktop.
Save gottadiveintopython/7605ac5e2d0eaebbc68f124619717087 to your computer and use it in GitHub Desktop.
'Sequence.stop_property()' doesn't affect to the next part of the animation
# case A ... 'stop_property()' affects to the next part of the animation
# case B ... 'stop_property()' doesn't affect to the next part of the animation
#
# This behavior confuses users.
from kivy.animation import Animation
from kivy.app import runTouchApp
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.clock import Clock
root = Widget()
button = Button()
root.add_widget(button)
def start_anim(dt):
anim = Animation(x=200) + Animation(x=0) # case A
# anim = Animation(x=200, y=200) + Animation(x=0) # case B
anim.start(button)
Clock.schedule_once(lambda *args: anim.stop_property(button, 'x'), .5)
Clock.schedule_once(start_anim)
runTouchApp(root)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment