Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from kivy.app import App
- from kivy.clock import Clock
- from kivy.properties import NumericProperty
- from kivy.lang import Builder
- KV = '''
- #:import cos math.cos
- #:import sin math.sin
- #:import chain itertools.chain
- Widget:
- points:
- list(
- chain(*
- ((
- cos(x / 100.) * cos(app.time + x) * self.width / 2 + self.width / 2,
- sin(x / 100.) * cos(app.time + x) * self.height / 2 + self.height / 2
- ) for x in range(0, 24 * 314, 4 * 314 / 6))
- ))
- canvas:
- Color:
- rgba: .5, .5, .5, 1
- Line:
- points: self.points or []
- width: 3
- '''
- class ClockApp(App):
- time = NumericProperty(0)
- def build(self):
- Clock.schedule_interval(self.update_clock, 0)
- self.root = Builder.load_string(KV)
- return self.root
- def update_clock(self, dt):
- self.time += dt
- if __name__ == '__main__':
- ClockApp().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement