本文整理匯總了Python中kivy.animation.Animation.cancel_all方法的典型用法代碼示例。如果您正苦於以下問題:Python Animation.cancel_all方法的具體用法?Python Animation.cancel_all怎麽用?Python Animation.cancel_all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kivy.animation.Animation
的用法示例。
在下文中一共展示了Animation.cancel_all方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: on_touch_down
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def on_touch_down(self, touch):
if not self.collide_point(*touch.pos):
touch.ud[self._get_uid('cavoid')] = True
return
if self.disabled:
return True
if self._touch:
return super(Carousel, self).on_touch_down(touch)
Animation.cancel_all(self)
self._touch = touch
uid = self._get_uid()
touch.grab(self)
touch.ud[uid] = {
'mode': 'unknown',
'time': touch.time_start}
Clock.schedule_once(self._change_touch_mode,
self.scroll_timeout / 1000.)
return True
示例2: on_touch_down
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def on_touch_down(self, touch):
if not self.disabled:
if touch.is_mouse_scrolling:
return False
if not self.collide_point(touch.x, touch.y):
return False
if self in touch.ud:
return False
Animation.cancel_all(self, 'elevation')
self.elevation_press_anim.start(self)
return super(MDRaisedButton, self).on_touch_down(touch)
示例3: on_touch_up
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def on_touch_up(self, touch):
if not self.disabled:
if touch.grab_current is not self:
return super(ButtonBehavior, self).on_touch_up(touch)
Animation.cancel_all(self, 'elevation')
self.elevation_release_anim.start(self)
return super(MDRaisedButton, self).on_touch_up(touch)
示例4: on_touch_down
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def on_touch_down(self, touch):
if touch.is_mouse_scrolling:
return False
if not self.collide_point(touch.x, touch.y):
return False
if not self.disabled:
if self.doing_ripple:
Animation.cancel_all(self, 'ripple_rad', 'ripple_color',
'rect_color')
self.anim_complete()
self.ripple_rad = self.ripple_rad_default
self.ripple_pos = (touch.x, touch.y)
if self.ripple_color != []:
pass
elif hasattr(self, 'theme_cls'):
self.ripple_color = self.theme_cls.ripple_color
else:
# If no theme, set Grey 300
self.ripple_color = [0.8784313725490196, 0.8784313725490196,
0.8784313725490196, self.ripple_alpha]
self.ripple_color[3] = self.ripple_alpha
self.lay_canvas_instructions()
self.finish_rad = max(self.width, self.height) * self.ripple_scale
self.start_ripple()
return super(CommonRipple, self).on_touch_down(touch)
示例5: finish_ripple
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def finish_ripple(self):
if self.doing_ripple and not self.finishing_ripple:
Animation.cancel_all(self, 'ripple_rad')
anim = Animation(ripple_rad=self.finish_rad,
t=self.ripple_func_in,
duration=self.ripple_duration_in_fast)
anim.bind(on_complete=self.fade_out)
self.finishing_ripple = True
anim.start(self)
示例6: fade_out
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def fade_out(self, *args):
rc = self.ripple_color
if not self.fading_out:
Animation.cancel_all(self, 'ripple_color')
anim = Animation(ripple_color=[rc[0], rc[1], rc[2], 0.],
t=self.ripple_func_out,
duration=self.ripple_duration_out)
anim.bind(on_complete=self.anim_complete)
self.fading_out = True
anim.start(self)
示例7: on_focus
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def on_focus(self, *args):
if self.focus:
Animation.cancel_all(self, '_line_width', '_hint_y',
'_hint_lbl_font_size')
if len(self.text) == 0:
self.hint_anim_in.start(self)
if not self.error:
self.anim.start(self)
else:
Animation.cancel_all(self, '_line_width', '_hint_y',
'_hint_lbl_font_size')
if len(self.text) == 0:
self.hint_anim_out.start(self)
if not self.error:
self._line_width = 0
示例8: _reset
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def _reset(self, *args):
Animation.cancel_all(self, '_angle_start', '_rotation_angle',
'_angle_end', '_alpha')
self._angle_start = 0
self._angle_end = 8
self._rotation_angle = 360
self._alpha = 0
self.active = False
示例9: on_touch_down
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def on_touch_down(self, touch):
if self.collide_point(touch.x, touch.y):
# self.anim_complete(self, self)
self.ripple_pos = ripple_pos = (touch.x, touch.y)
Animation.cancel_all(self, 'ripple_rad', 'ripple_color')
rc = self.ripple_color
ripple_rad = self.ripple_rad
self.ripple_color = [rc[0], rc[1], rc[2], 1.]
anim = Animation(
ripple_rad=max(self.width, self.height) * self.ripple_scale,
t=self.ripple_func_in,
ripple_color=[rc[0], rc[1], rc[2], self.fade_to_alpha],
duration=self.ripple_duration_in)
anim.bind(on_complete=self.anim_complete)
anim.start(self)
with self.canvas:
StencilPush()
Rectangle(size=self.size, pos=self.pos)
StencilUse()
self.col_instruction = Color(
rgba=self.ripple_color, group='one')
self.ellipse = Ellipse(
size=(ripple_rad, ripple_rad),
pos=(ripple_pos[0] - ripple_rad/2.,
ripple_pos[1] - ripple_rad/2.),
group='one')
StencilUnUse()
Rectangle(size=self.size, pos=self.pos)
StencilPop()
self.bind(
ripple_color=self.set_color, ripple_pos=self.set_ellipse,
ripple_rad=self.set_ellipse)
return super(TouchRippleBehavior, self).on_touch_down(touch)
示例10: on_state
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def on_state(self, *args):
Animation.cancel_all(self)
if self.state == 'open':
self._anim_progress = 1
else:
self._anim_progress = 0
示例11: on_touch_down
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def on_touch_down(self, touch):
col_self = self.collide_point(*touch.pos)
col_side = self._side_panel.collide_point(*touch.pos)
col_main = self._main_panel.collide_point(*touch.pos)
if self._anim_progress < 0.001: # i.e. closed
valid_region = (self.x <=
touch.x <=
(self.x + self.touch_accept_width))
if not valid_region:
self._main_panel.on_touch_down(touch)
return False
else:
if col_side and not self._main_above:
self._side_panel.on_touch_down(touch)
return False
valid_region = (self._main_panel.x <=
touch.x <=
(self._main_panel.x + self._main_panel.width))
if not valid_region:
if self._main_above:
if col_main:
self._main_panel.on_touch_down(touch)
elif col_side:
self._side_panel.on_touch_down(touch)
else:
if col_side:
self._side_panel.on_touch_down(touch)
elif col_main:
self._main_panel.on_touch_down(touch)
return False
Animation.cancel_all(self)
self._anim_init_progress = self._anim_progress
self._touch = touch
touch.ud['type'] = self.state
touch.ud['panels_jiggled'] = False # If user moved panels back
# and forth, don't default
# to close on touch release
touch.grab(self)
return True
示例12: animate_open
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def animate_open(self):
Animation.cancel_all(self)
self.anim_progress = 1
Animation(anim_progress=0, d=0.4, t='out_cubic').start(self)
示例13: animate_dismiss
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def animate_dismiss(self):
Animation.cancel_all(self)
anim = Animation(anim_progress=1, d=0.2, t='out_cubic')
anim.bind(on_complete=self.immediate_dismiss)
anim.start(self)
示例14: ensure_no_ctrl_c_button
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def ensure_no_ctrl_c_button(self):
Clock.unschedule(self._switch_to_ctrl_c_button)
c = self.ids.carousel
if c.index == 1:
c.load_previous()
else:
Animation.cancel_all(c)
c._start_animation(new_offset=0)
示例15: on_touch_down
# 需要導入模塊: from kivy.animation import Animation [as 別名]
# 或者: from kivy.animation.Animation import cancel_all [as 別名]
def on_touch_down(self, touch):
if self.collide_point(touch.x, touch.y):
# self.anim_complete(self, self)
self.ripple_pos = ripple_pos = (touch.x, touch.y)
Animation.cancel_all(self, 'ripple_rad', 'ripple_color')
rc = self.ripple_color
ripple_rad = self.ripple_rad
self.ripple_color = [rc[0], rc[1], rc[2], 1.]
anim = Animation(
ripple_rad=max(self.width, self.height) * self.ripple_scale,
t=self.ripple_func_in,
ripple_color=[rc[0], rc[1], rc[2], self.fade_to_alpha],
duration=self.ripple_duration_in)
anim.bind(on_complete=self.anim_complete)
anim.start(self)
with self.canvas:
StencilPush()
Rectangle(size=self.size, pos=self.pos)
StencilUse()
self.col_instruction = Color(rgba=self.ripple_color, group='one')
self.ellipse = Ellipse(size=(ripple_rad, ripple_rad),
pos=(ripple_pos[0] - ripple_rad/2.,
ripple_pos[1] - ripple_rad/2.),
group='one')
StencilUnUse()
Rectangle(size=self.size, pos=self.pos)
StencilPop()
self.bind(ripple_color=self.set_color, ripple_pos=self.set_ellipse,
ripple_rad=self.set_ellipse)
return super(TouchRippleBehavior, self).on_touch_down(touch)