Skip to content

Instantly share code, notes, and snippets.

@tshirtman
Created October 8, 2019 20:05
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/43b93eb4b9a43e0f39258ffe49b9b4f8 to your computer and use it in GitHub Desktop.
Save tshirtman/43b93eb4b9a43e0f39258ffe49b9b4f8 to your computer and use it in GitHub Desktop.
line demos on scatter plane
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
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