Skip to content

Instantly share code, notes, and snippets.

@tshirtman
Created October 8, 2019 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tshirtman/4aef497c0cd1ae1fa3c642279a3f65b5 to your computer and use it in GitHub Desktop.
Save tshirtman/4aef497c0cd1ae1fa3c642279a3f65b5 to your computer and use it in GitHub Desktop.
from kivy.app import App
from kivy.lang import Builder
from kivy.factory import Factory
KV = '''
#:import Animation kivy.animation.Animation
FloatLayout:
ScatterPlane:
id: plane
canvas:
Line:
width: 0.5
rectangle: 100, 100, 100, 100
Line:
width: 1.0
rectangle: 125, 125, 100, 100
Line:
width: 0.50000001
rectangle: 150, 150, 100, 100
Line:
width: 1.00000001
rectangle: 175, 175, 100, 100
Line:
width: 0.5
rectangle: 300.5, 100, 100, 100
Line:
width: 1.0
rectangle: 325.5, 125, 100, 100
Line:
width: 0.50000001
rectangle: 350.5, 150, 100, 100
Line:
width: 1.00000001
rectangle: 375.5, 175, 100, 100
Line:
width: 0.5
rectangle: 300.5, 300.5, 100, 100
Line:
width: 1.0
rectangle: 325.5, 325.5, 100, 100
Line:
width: 0.50000001
rectangle: 350.5, 350.5, 100, 100
Line:
width: 1.00000001
rectangle: 375.5, 375.5, 100, 100
BoxLayout:
size_hint_y: None
height: 36
Button:
text: 'zoom'
on_press:
Animation.cancel_all(plane, 'scale')
Animation(scale=plane.scale * 1.1, t='out_quad', d=.5).start(plane)
Button:
text: 'rotate'
on_press:
Animation.cancel_all(plane, 'rotate')
Animation(rotation=plane.rotation + 10, t='out_quad', d=.5).start(plane)
Button:
text: 'reset'
on_press:
Animation.cancel_all(plane)
Animation(rotation=0, scale=1, pos=(0, 0), t='out_quad', d=.5).start(plane)
'''
class Application(App):
def build(self):
return Builder.load_string(KV)
if __name__ == "__main__":
Application().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment