Created
October 8, 2019 20:17
-
-
Save tshirtman/4aef497c0cd1ae1fa3c642279a3f65b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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