How to use the kivy.animation.Animation function in Kivy

To help you get started, we’ve selected a few Kivy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitcraft / tailor / tailor / uix / picker.py View on Github external
t='in_out_quad',
            size_hint=(4, 2),
            duration=.5)
        ani += Animation(
            pos_hint={'x': x + 1.5},
            duration=480)
        self.start_and_log(ani, self.background)

        # show the focus widget
        ani = Animation(
            opacity=1.0,
            pos_hint={'top': 1, 'center_x': .75},
            size_hint=(1, 1),
            t='in_out_quad',
            duration=.5)
        ani &= Animation(
            opacity=1.0,
            duration=.5)
        self.start_and_log(ani, self.focus_widget)

        # schedule a unlock
        self.locked = True
        Clock.schedule_once(self.unlock, .5)
github HeaTTheatR / KivyMD / kivymd / vendor / circularTimePicker / __init__.py View on Github external
else:
            self.is_animating()
            if prevpicker in container.children:
                anim = Animation(scale=1.5, d=0.5, t="in_back") & Animation(
                    opacity=0, d=0.5, t="in_cubic"
                )
                anim.start(prevpicker)
                Clock.schedule_once(
                    lambda *y: container.remove_widget(prevpicker), 0.5
                )  # .31)
            picker.scale = 1.5
            picker.opacity = 0
            if picker.parent:
                picker.parent.remove_widget(picker)
            container.add_widget(picker)
            anim = Animation(scale=1, d=0.5, t="out_back") & Animation(
                opacity=1, d=0.5, t="out_cubic"
            )
            anim.bind(on_complete=self.is_not_animating)
            Clock.schedule_once(lambda *y: anim.start(picker), 0.3)
github kivy-garden / garden.roulette / __init__.py View on Github external
def center_on(self, val, animate=True):
        Animation.stop_all(self)
        center_index = self.index_of(val)
        half_length = self.line_length / 2. / self.scale
        index_0 = center_index - half_length
        index_1 = center_index + half_length
        if animate:
            anim = Animation(index_0=index_0, index_1=index_1,
                             duration=self.center_duration)
            anim.on_complete = lambda *args: self._centered()
            anim.start(self)
        else:
            self.index_0 = index_0
            self.index_1 = index_1
            self._centered()
    def on_centered(self, *args):
github HeaTTheatR / KivyMD / demos / kitchen_sink / demo_apps / coffeemenu.py View on Github external
def show_menu_animation(self):
        Animation(x=0, d=0.2).start(self.ids.top_menu)
        Animation(x=Window.width - self.ids.bottom_menu.width, d=0.2).start(
            self.ids.bottom_menu
        )
github AndreMiras / KivyMD / kivymd / vendor / navigationdrawer / __init__.py View on Github external
def anim_to_state(self, state):
        '''If not already in state `state`, animates smoothly to it, taking
        the time given by self.anim_time. State may be either 'open'
        or 'closed'.

        '''
        if state == 'open':
            anim = Animation(_anim_progress=1,
                             duration=self.anim_time,
                             t=self.closing_transition)
            anim.start(self)
        elif state == 'closed':
            anim = Animation(_anim_progress=0,
                             duration=self.anim_time,
                             t=self.opening_transition)
            anim.start(self)
        else:
            raise NavigationDrawerException(
                'Invalid state received, should be one of `open` or `closed`')
github AndreMiras / KivyMD / kivymd / slidingpanel.py View on Github external
def _get_main_animation(self, duration, t, x, is_closing):
        return Animation(duration=duration, t=t, x=x)
github AXErunners / electrum-axe / electrum_axe / gui / kivy / uix / menus.py View on Github external
def hide(self, *dt):

        def on_stop(*l):
            Window.remove_widget(self)
        anim = Animation(opacity=0, d=.25)
        anim.bind(on_complete=on_stop)
        anim.cancel_all(self)
        anim.start(self)
github snuq / Snu-Photo-Manager / generalelements.py View on Github external
def __init__(self, **kwargs):
        self.background_animation = Animation()
        self.text_animation = Animation()
        app = App.get_running_app()
        self.background_color = app.theme.button_up
        self.target_background = self.background_color
        self.color = app.theme.button_text
        self.target_text = self.color
        super(ButtonBase, self).__init__(**kwargs)
github ahmedfgad / CoinTex / main.py View on Github external
#            remaining_life_percent_lvl_widget.text = str(int(life_remaining_percent))+"%"
            remaining_life_percent_lvl_widget=curr_screen.ids['remaining_life_percent_lvl'+str(screen_num)]
            remaining_life_size_hint_x = remaining_life_percent_lvl_widget.remaining_life_size_hint_x
            remaining_life_percent_lvl_widget.size_hint =  (remaining_life_size_hint_x-remaining_life_size_hint_x*life_percent, remaining_life_percent_lvl_widget.size_hint[1])

            if curr_screen.num_collisions_hit == curr_screen.num_collisions_level:
                self.bg_music.stop()
                self.char_death_sound.play()
                curr_screen.character_killed = True

                kivy.animation.Animation.cancel_all(character_image)
                for i in range(curr_screen.num_monsters): kivy.animation.Animation.cancel_all(curr_screen.ids['monster'+str(i+1)+'_image_lvl'+str(screen_num)])
                for i in range(curr_screen.num_fires): kivy.animation.Animation.cancel_all(curr_screen.ids['fire'+str(i+1)+'_lvl'+str(screen_num)])

                character_image.im_num = character_image.dead_start_im_num
                char_anim = kivy.animation.Animation(im_num=character_image.dead_end_im_num, duration=1.0)
                char_anim.start(character_image)
                kivy.clock.Clock.schedule_once(functools.partial(self.back_to_main_screen, curr_screen.parent), 3)
github snuq / Snu-Photo-Manager / generalelements.py View on Github external
def set_background(self, color, instant=False):
        if self.target_background == color:
            return
        app = App.get_running_app()
        self.background_animation.stop(self)
        if app.animations and not instant:
            self.background_animation = Animation(background_color=color, duration=app.animation_length)
            self.background_animation.start(self)
        else:
            self.background_color = color
        self.target_background = color