本文整理汇总了Python中kivy.animation.Animation方法的典型用法代码示例。如果您正苦于以下问题:Python animation.Animation方法的具体用法?Python animation.Animation怎么用?Python animation.Animation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.animation
的用法示例。
在下文中一共展示了animation.Animation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def start( self ) :
self.pos = (
self.root_layout.width/2 - self.width/2,
self.root_layout.height+self.height-dp(56)
)
animation = Animation(
y=self.root_layout.height-2*self.height,
duration=self.duracy
)
animation.start( self )
self.angle = 0
self._hex = 0
self._color = 0, 0, 0, 1
self.root_layout.add_widget( self )
Clock.schedule_interval( self.update_animation, 0.04 )
示例2: open
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def open(self, *largs):
'''Show the view window from the :attr:`attach_to` widget. If set, it
will attach to the nearest window. If the widget is not attached to any
window, the view will attach to the global
:class:`~kivy.core.window.Window`.
'''
if self._window is not None:
Logger.warning('ModalView: you can only open once.')
return self
# search window
self._window = self._search_window()
if not self._window:
Logger.warning('ModalView: cannot open view, no window found.')
return self
self._window.add_widget(self)
self._window.bind(on_resize=self._align_center,
on_keyboard=self._handle_keyboard)
self.center = self._window.center
self.bind(size=self._update_center)
a = Animation(_anim_alpha=1., d=self._anim_duration)
a.bind(on_complete=lambda *x: self.dispatch('on_open'))
a.start(self)
return self
示例3: on_activated
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def on_activated(self, instance, activated):
if not activated:
self.grect.size = 0, 0
if self.at_bottom:
anim = Animation(top=0, t='out_quad', d=.3)
else:
anim = Animation(y=self.height, t='out_quad', d=.3)
anim.bind(on_complete=self.animation_close)
anim.start(self.layout)
self.widget = None
self.widget_info = False
else:
self.win.add_widget(self)
Logger.info('Inspector: inspector activated')
if self.at_bottom:
Animation(top=60, t='out_quad', d=.3).start(self.layout)
else:
Animation(y=self.height - 60, t='out_quad', d=.3).start(
self.layout)
示例4: start
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def start(self, manager):
'''(internal) Starts the transition. This is automatically
called by the :class:`ScreenManager`.
'''
if self.is_active:
raise ScreenManagerException('start() is called twice!')
self.manager = manager
self._anim = Animation(d=self.duration, s=0)
self._anim.bind(on_progress=self._on_progress,
on_complete=self._on_complete)
self.add_screen(self.screen_in)
self.screen_in.transition_progress = 0.
self.screen_in.transition_state = 'in'
self.screen_out.transition_progress = 0.
self.screen_out.transition_state = 'out'
self.screen_in.dispatch('on_pre_enter')
self.screen_out.dispatch('on_pre_leave')
self.is_active = True
self._anim.start(self)
self.dispatch('on_progress', 0)
示例5: open
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def open(self, *largs):
'''Show the view window from the :attr:`attach_to` widget. If set, it
will attach to the nearest window. If the widget is not attached to any
window, the view will attach to the global
:class:`~kivy.core.window.Window`.
'''
if self._window is not None:
Logger.warning('ModalView: you can only open once.')
return self
# search window
self._window = self._search_window()
if not self._window:
Logger.warning('ModalView: cannot open view, no window found.')
return self
self._window.add_widget(self)
self._window.bind(
on_resize=self._align_center,
on_keyboard=self._handle_keyboard)
self.center = self._window.center
self.bind(size=self._update_center)
a = Animation(_anim_alpha=1., d=self._anim_duration)
a.bind(on_complete=lambda *x: self.dispatch('on_open'))
a.start(self)
return self
示例6: stop_spinning
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def stop_spinning(self, *args):
'''Stop spinning the progress spinner. Ignores all positional args
for easy binding.
If you intend to keep the spinner around, you should stop it when
not using it and restart it when needed again.
'''
if self._spinning:
if self._next:
if isinstance(self._next, Animation):
self._next.cancel(self)
else:
self._next.cancel()
Clock.unschedule(self._update)
Clock.unschedule(self._rotate)
self._angle_start = self._angle_end = 0
self._spinning = False
示例7: add_to_bottom_right
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def add_to_bottom_right( self, parent ) :
nx = parent.width-self.diameter*1.2
ny = self.diameter*0.3
parent.bind( size=self._repose )
parent.add_widget( self )
duracy = self.animation_duracy if self.entrance != '' else 0
if duracy > 0 :
if self.entrance == 'down' : self.pos = [ nx, -self.height ]
if self.entrance == 'up' : self.pos = [ nx, self.pos[1]+self.height ]
if self.entrance == 'left' : self.pos = [ -self.width, ny ]
if self.entrance == 'right' : self.pos = [ +self.width, ny ]
animation = Animation( x=nx, y=ny, duration=duracy )
animation.start( self )
else :
self.pos = nx, ny
self.parent = parent
示例8: open
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def open(self, *largs):
'''Show the view window from the :attr:`attach_to` widget. If set, it
will attach to the nearest window. If the widget is not attached to any
window, the view will attach to the global
:class:`~kivy.core.window.Window`.
'''
if self._window is not None:
Logger.warning('ModalView: you can only open once.')
return self
# search window
self._window = self._search_window()
if not self._window:
Logger.warning('ModalView: cannot open view, no window found.')
return self
self._window.add_widget(self)
self._window.bind(on_resize=self._align_center,
on_keyboard=self._handle_keyboard)
self.center = self._window.center
self.bind(size=self._align_center)
a = Animation(_anim_alpha=1., d=self._anim_duration)
a.bind(on_complete=lambda *x: self.dispatch('on_open'))
a.start(self)
return self
示例9: dismiss
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def dismiss(self, *largs, **kwargs):
'''Close the view if it is open. If you really want to close the
view, whatever the on_dismiss event returns, you can use the *force*
argument:
::
view = ModalView(...)
view.dismiss(force=True)
When the view is dismissed, it will be faded out before being
removed from the parent. If you don't want animation, use::
view.dismiss(animation=False)
'''
if self._window is None:
return self
if self.dispatch('on_dismiss') is True:
if kwargs.get('force', False) is not True:
return self
if kwargs.get('animation', True):
Animation(_anim_alpha=0., d=self._anim_duration).start(self)
else:
self._anim_alpha = 0
self._real_remove_widget()
return self
示例10: show
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def show(self, desc):
self.text = desc
anim = Animation(y = metrics.dp(50), t = 'in_out_expo')
anim.start(self)
Clock.schedule_once(self.exit, 5)
示例11: exit
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def exit(self, dt):
Clock.unschedule(self.exit)
anim = Animation(y = metrics.dp(-50), t = 'in_out_expo')
anim.start(self)
示例12: start_display
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def start_display(self, touch):
touch.grab(self)
a = Animation(circle_progress=1, d=self.creation_timeout)
a.bind(on_complete=self.open_menu)
touch.ud['animation'] = a
a.start(self)
示例13: dismiss
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def dismiss(self):
a = Animation(opacity=0)
a.bind(on_complete=self._remove)
a.start(self)
示例14: frontal
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def frontal(self):
Animation(rotate=(0.0, 1.0, 0.0, 0.0), translate=(-5, 0, -110), duration=1.0).start(self.board)
for i, n in enumerate(self.red_n):
(Animation(translate=(-30,20,-40), duration=(i+1)/(self.delay*1.0)) +
Animation(translate=n["front"], rotate=(0,1.0,0.0,0.0), duration=(i+1)/self.delay+1,t='in_quad')).start(n["node"])
for i, n in enumerate(self.green_n):
(Animation(translate=(30,-20,-40), duration=(i+1)/(self.delay*1.0)) +
Animation(translate=n["front"], rotate=(0,1.0,0.0,0.0), duration=(i+1)/self.delay+1,t='in_quad')).start(n["node"])
示例15: perspective
# 需要导入模块: from kivy import animation [as 别名]
# 或者: from kivy.animation import Animation [as 别名]
def perspective(self):
Animation(rotate=(-90.0, 1.0, 0.0, 0.0), translate=(-5, -25, -110),duration=1.0).start(self.board)
for i, n in enumerate(self.red_n):
(Animation(translate=(-30,20,-90), duration=(i+1)/(self.delay*1.0)) +
Animation(translate=n["persp"], rotate=(-90,1.0,0.0,0.0), duration=(i+1)/self.delay+1,t='in_quad')).start(n["node"])
for i, n in enumerate(self.green_n):
(Animation(translate=(30,-20,-90), duration=(i+1)/(self.delay*1.0)) +
Animation(translate=n["persp"], rotate=(-90,1.0,0.0,0.0), duration=(i+1)/self.delay+1,t='in_quad')).start(n["node"])