Last active
April 20, 2018 10:00
-
-
Save tshirtman/6c56f2b364e0b31354fb to your computer and use it in GitHub Desktop.
This file contains hidden or 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.clock import Clock | |
| from kivy.properties import NumericProperty | |
| KV = ''' | |
| #:import chain itertools.chain | |
| #:import pi math.pi | |
| #:import sin math.sin | |
| #:import cos math.cos | |
| #:set X 10 | |
| Widget: | |
| points: | |
| list( | |
| chain(*([ | |
| self.center_x + sin((app.time + x * pi / X + pi / 2) * (.5 + .5 * sin(app.time + x * pi / X))) * 100, | |
| self.center_y + cos((app.time + x * pi / X + pi / 2) * (.5 + .5 * sin(app.time + x * pi / X))) * 100, | |
| ] for x in range(2 * X)))) | |
| canvas: | |
| Color: | |
| rgba: 1, 1, 1, 1 | |
| Line: | |
| points: self.points or [] | |
| close: True | |
| ''' # noqa | |
| class WaitingApp(App): | |
| time = NumericProperty(0) | |
| def update_clock(self, dt): | |
| self.time += dt | |
| def build(self): | |
| Clock.schedule_interval(self.update_clock, 0) | |
| return Builder.load_string(KV) | |
| if __name__ == '__main__': | |
| WaitingApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment