Advertisement
2n2u

Untitled

Jan 30th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.62 KB | None | 0 0
  1.     def on_touch_down(self, touch):
  2.         if self.collide_point(touch.x, touch.y):
  3.             self.parent.index = self._index
  4.             temp_color = App.get_running_app().theme_cls.primary_color
  5.             temp_color[3] = .4
  6.             ellipse_group = InstructionGroup()
  7.             ellipse_group.add(Color(*App.get_running_app().theme_cls.primary_color))
  8.             ellipse = Ellipse(size=(self.height, self.height), pos=(self.ids.day.center_x - self.height / 2,
  9.                                                                     self.ids.day.center_y - self.height / 2))
  10.             circle = Line(circle=(self.ids.day.center_x, self.ids.day.center_y, self.radius), width=dp(2.5))
  11.             self.bind(radius=lambda *x: on_radius())
  12.             ellipse_group.add(circle)
  13.             ellipse_group.add(Color(*temp_color))
  14.             ellipse_group.add(ellipse)
  15.             self.canvas.add(ellipse_group)
  16.             anim = Animation(width=dp(5.5),
  17.                              duration=self.duration)
  18.             anim.bind(on_complete=lambda *largs: animate())
  19.             anim.start(circle)
  20.             anim2 = Animation(radius=dp(20))
  21.             anim2.start(self)
  22.             self.callback(self)
  23.  
  24.             def on_radius():
  25.                 circle.circle = (self.ids.day.center_x, self.ids.day.center_y, self.radius)
  26.  
  27.         def animate():
  28.             ellipse_group.remove(ellipse)
  29.             anim2 = Animation(width=.1, duration=self.duration)
  30.             anim2.bind(on_complete=lambda *largs: animate_1())
  31.             anim2.start(circle)
  32.  
  33.         def animate_1():
  34.             self.canvas.remove(ellipse_group)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement