def __init__(self, **kwargs): self.pos_hint = {'y': .25} super().__init__(**kwargs) textos = BoxLayout(orientation='vertical', size_hint=(.8, .55)) welcome = Label(text='\nWelcome', color=(0, 0, 0, 1), halign='center', font_name='fonts/DEPLETED_URANIUM.ttf', font_size=60) to = Label(text='\nTo', color=(0, 0, 0, 1), halign='right', font_size=60, font_name='fonts/DEPLETED_URANIUM.ttf') in4play = Label(text='\nIN4PLAY', color=(0, 0, 0, 1), font_size=60, font_name='fonts/DEPLETED_URANIUM.ttf') click = Label(text='\nClick anywhere on the screen', color=(0, 0, 0, 1), font_name='fonts/LittleBird.ttf', font_size=20) logo = Image(source='img/logo.png') off = '\nYOU ARE OFFLINE' on = '\nARE YOU ONLINE' status = users_repositorio.Users_Repositorio.get_status() conexao = Label(text=on if status else off, color=get_color_from_hex('#148C02') if status else get_color_from_hex('#C20E0E'), font_name='fonts/LittleBird.ttf', font_size=20) textos.add_widget(logo) textos.add_widget(welcome) textos.add_widget(to) textos.add_widget(in4play) textos.add_widget(click) textos.add_widget(conexao) self.add_widget(textos) animText = Animation( color=get_color_from_hex('#A90D0D'), duration=0.5) + Animation( color=get_color_from_hex('#600CCF'), duration=0.5) animText.repeat = True animText.start(welcome) animText = Animation( color=get_color_from_hex('#0B77CA'), duration=0.5) + Animation( color=get_color_from_hex('#0DA927'), duration=0.5) animText.repeat = True animText.start(to) animText = Animation(color=(0, 0, 0, 1)) + Animation( color=get_color_from_hex('#FFD700')) animText.repeat = True animText.start(in4play)
def __init__(self, **kwargs): super(Loading, self).__init__(**kwargs) anim1 = Animation(angle = 360, duration=2) anim1 += Animation(angle = 360, duration=2) anim1.repeat = True anim2 = Animation(opacity=0.3, width=100, duration=0.6) anim2 += Animation(opacity=1, width=400, duration=0.8) anim2.repeat = True anim1.start(self) anim2.start(self)
def build(self): self.theme_cls.primary_palette = "Blue" self.theme_cls.theme_style = 'Light' self.theme_cls.accent_palette = "Yellow" self.strng = Builder.load_string(janela) animka = Animation(text_color = (1,1,1,1)) + Animation(text_color = (1,1,1, .2)) animka.repeat = True animka.start(self.strng.get_screen("empre").ids.cad) an = Animation(text_color = (1,1,1,1)) + Animation(text_color = (1,1,1, .2)) an.repeat = True an.start(self.strng.get_screen("empre").ids.cd) animae = Animation(text_color = (1,1,1,1)) + Animation(text_color = (1,1,1, .2)) animae.repeat = True animae.start(self.strng.get_screen("login").ids.acessar) animaed = Animation(text_color = (1,1,1,1)) + Animation(text_color = (1,1,1, .2)) animaed.repeat = True animaed.start(self.strng.get_screen("login").ids.grav) animaal = Animation(text_color = ([71/200,73/200,82/200,2])) + Animation (text_color = (1,1,1,1)) animaal.repeat=True animaal.start(self.strng.get_screen("empre").ids.updd) aimaak = Animation(text_color = ([169/255,169/255,169/255,2])) + Animation (text_color = (128/255,128/255,128/255,1)) aimaak.repeat=True aimaak.start(self.strng.get_screen("empre").ids.atc) animali = Animation(text_color = ([169/255,169/255,169/255,2])) + Animation (text_color = (128/255,128/255,128/255,1)) animali.repeat=True animali.start(self.strng.get_screen("empre").ids.ped) animalid = Animation(text_color = ([169/255,169/255,169/255,2])) + Animation (text_color = (128/255,128/255,128/255,1)) animalid.repeat=True animalid.start(self.strng.get_screen("empre").ids.pede) animalui = Animation(text_color = ([169/255,169/255,169/255,2])) + Animation (text_color = (128/255,128/255,128/255,1)) animalui.repeat=True animalui.start(self.strng.get_screen("empre").ids.peo) animaluiy = Animation(text_color = ([169/255,169/255,169/255,2])) + Animation (text_color = (128/255,128/255,128/255,1)) animaluiy.repeat=True animaluiy.start(self.strng.get_screen("empre").ids.pedu) animaea = Animation(size_hint_y = (0.88),duration=1) animaea.start(self.strng.get_screen("login").ids.card37) return self.strng
def build(self): # Defino quantos pixels vai se mexer para eixo X e eixo Y ani = Animation(x=-220, y = 200, duration=2.) + Animation(x = -220, y = -200, duration=2.) ani.repeat = True # Label vem com posição posição inicial no meio lb = Label( text = '[u][color=ff9933]Teste[/color][/u]', font_size = 30, markup = True ) ini = ani.start(lb) ani.repeat = False return lb
def confirmacao(self, *args, **kwargs): global popSound popSound.play() self.export_to_png('Menu.png') print('Chamou') box = BoxLayout(orientation='vertical', padding=10, spacing=10) botoes = BoxLayout(padding=10, spacing=10) pop = Popup(title='Deseja mesmo sair?', content=box, size_hint=(None, None), size=(150, 150)) sim = Botao(text='Sim', on_release=App.get_running_app().stop) nao = Botao(text='NĂŁo', on_release=pop.dismiss) botoes.add_widget(sim) botoes.add_widget(nao) atencao = Image(source='atencao.png') box.add_widget(atencao) box.add_widget(botoes) animText = Animation(color=(0, 0, 0, 1)) + Animation(color=(1, 1, 1, 1)) animText.repeat = True animText.start(sim) anim = Animation(size=(300, 180), duration=0.2, t='out_back') anim.start(pop) pop.open() return True
def confirmacao(self, *args, **kwargs): """Popup de Confirmação de Saida.""" box = BoxLayout(orientation='vertical', padding=10, spacing=10) botoes = BoxLayout(padding=10, spacing=10) pop = Popup(title='Deseja mesmo sair?', content=box, size_hint=(None, None), size=(200, 200)) sim = Button(text='Sim', on_release=App.get_running_app().stop) nao = Button(text='Não', on_release=pop.dismiss) sim.background_color = (0.1607843137254902, 0.7137254901960784, 0.9647058823529412, 1) nao.background_color = (0.1607843137254902, 0.7137254901960784, 0.9647058823529412, 1) botoes.add_widget(sim) botoes.add_widget(nao) atencao = Image(source='res/atencao.png') box.add_widget(atencao) box.add_widget(botoes) animText = Animation(color=(0, 0, 0, 1)) + \ Animation(color=(1, 1, 1, 1)) animText.repeat = True animText.start(sim) anim = Animation(size=(300, 180), duration=0.2, t='out_back') anim.start(pop) pop.open() return True
def __init__(self, **kwargs): Builder.load_file("animation.kv") super(AnimationScreen, self).__init__(**kwargs) anit = Animation(x=0, y=0) + Animation(size=(1, 1)) + Animation(x=500, y=500) + Animation( size=(1000, 1000)) anit.repeat = True anit.start(self.animr)
def erroPopUp(self, text=''): #Toca o som do popUp global popSound popSound.play() box = BoxLayout(orientation='vertical', padding=10, spacing=10) pop = Popup(title="Erro", content=box, size_hint=(None, None), size=(100, 100)) ok = ButtonInicio(text='Ok', on_release=pop.dismiss) texto = Label(text=text) box.add_widget(texto) box.add_widget(ok) #Animações do texto do botão "ok": pisca nas cores preto e branco animText = Animation(color=(0, 0, 0, 1), duration=0.8) + Animation( color=(1, 1, 1, 1), duration=0.8) animText.repeat = True animText.start(ok) # Animações do PopUp: começa pequeno e atinge um tamanho maior anim = Animation(size=(500, 180), duration=0.15, t='out_back') anim.start(pop) pop.open() return True
def confirmation(self, *args, **kwargs): #global popSound #popSound.play() self.export_to_png('Menu.png') box = BoxLayout(orientation='vertical', padding=10, spacing=10) buttons = BoxLayout(padding=10, spacing=10) pop = Popup(title='Sure?', content=box, size_hint=(None, None), size=(150, 150)) yes = CustButton(text='Yes', on_release=App.get_running_app().stop) no = CustButton(text='No', on_release=pop.dismiss) buttons.add_widget(yes) buttons.add_widget(no) attention = Image(source='freud.png') box.add_widget(attention) box.add_widget(buttons) animText = Animation(color=(0, 0, 0, 1)) + Animation(color=(1, 1, 1, 1)) animText.repeat = True animText.start(yes) anim = Animation(size=(300, 180), duration=0.2, t='out_back') anim.start(pop) pop.open() return True
def confirmacao(self, *args, **kargs): box = BoxLayout(orientation='vertical', padding=10, spacing=10) botoes = BoxLayout(padding=10, spacing=10) popup = Popup(title='Deseja mesmo sair?', content=box, size_hint=(None, None), size=(150, 150)) sim = Botao(text='Sim', on_release=App.get_running_app().stop) nao = Botao(text='NĂŁo', on_release=popup.dismiss) botoes.add_widget(sim) botoes.add_widget(nao) atencao = Image(source='atencao.jpg') box.add_widget(atencao) box.add_widget(botoes) animText = Animation(color=(0, 0, 0, 1)) + Animation( color=(1, 1, 1, 1)) # animacoes em paralelo '&' animText.repeat = True animText.start(sim) anim = Animation(size=(300, 180), duration=0.2, t='out_back') anim.start(popup) popup.open() return True
def tutorial_arrow(self, btn): # print len(self.tutorialLayout.children), " lenght before" while len(self.tutorialLayout.children) != 0: self.tutorialLayout.remove_widget(self.tutorialLayout.children[0]) if len(self.tutorialLayout.children) == 0: if platform == 'win' or platform == 'linux': self.tutorial_arrow_image = Image( source=os.path.join(os.getcwd(), 'images', 'tutorial_arrow.png'), size_hint_y=None, height=Window.width / 16, pos_hint={ 'x': .46, 'top': self.firstNumberspinner.pos_hint['top'] - .22 }) else: self.tutorial_arrow_image = Image( source=os.path.join(os.getcwd(), 'images', 'tutorial_arrow.png'), size_hint_y=None, height=Window.width / 9, pos_hint={ 'x': .41, 'top': self.firstNumberspinner.pos_hint['top'] - .22 }) self.tutorialLayout.add_widget(self.tutorial_arrow_image) anim = Animation(y=-10, duration=.6) + Animation(y=10, duration=.4) anim.repeat = True anim.start(self.tutorialLayout)
def __init__(self, **kwargs): Builder.load_file('sideScreen.kv') super(SideScreen, self).__init__(**kwargs) anim = Animation(x=50) + Animation(size=(180, 80)) + Animation(x=90) + Animation(size=(150, 150)) + Animation( y=50) + Animation(y=150) anim.repeat = True anim.start(self.fly2)
def animSpin(self): stopAnim(self) anim = Animation(songImageAngle=-360, duration=3.5) anim += Animation(songImageAngle=0, duration=0) anim.repeat = True anim.start(self)
def move_logo(self, *args): screen = self._app.sm.get_screen('initial_screen') logo_object = screen.ids['logo'] window_x, window_y = Window.size anim = Animation(y=window_y-(window_y/1.5), duration=6, t='in_bounce') + Animation(y=0, duration=6, t='out_bounce') anim.repeat = True anim.start(logo_object)
def animate(self): anim = Animation(opacity=0, duration=1) + Animation(opacity=1, duration=1) anim += Animation(opacity=0, duration=1) + Animation(opacity=1, duration=1) anim.repeat = True anim.start(self.prompt)
def start_animations(self): # save the button's initial x position for future use start_x = self.button.x # save the button's background color for future use button_color = self.button.background_color # Let's create an animation consisting of two animations joined # sequentially to animate the x position of the button. It will # move to the right in three seconds and then back to the left # in half a second. pos_anim = Animation(x=400, d=3) + Animation(x=start_x, d=.5) # Let's create another animation consisting of two animations # joined sequentially to animate the background color of the button. # It will change to red in 0.2 seconds and then back to its original # color in 0.1 seconds. This will make the button pulsate. color_anim = (Animation(background_color=[1, 0, 0, 1], d=.2) + Animation(background_color=button_color, d=.1)) # set the animations to repeat pos_anim.repeat = True color_anim.repeat = True # Let's make the two combined animations run in parallel. anim = pos_anim & color_anim # start the combined animation anim.start(self.button)
def kabulet(self, *args, **kwargs): global popapSes popapSes.play() # çıkış popap sesi print('Aradığı') kutu = BoxLayout(orientation='vertical', padding=10, spacing=10) buton = BoxLayout(padding=10, spacing=10) açıl = Popup(title='Çıkmak istediğinden emin misin?', content=kutu, size_hint=(None, None), size=(300, 180)) evet = OvalButon(text='Evet', on_release=App.get_running_app().stop) hayır = OvalButon(text='Hayır', on_release=açıl.dismiss) buton.add_widget(evet) buton.add_widget(hayır) uyarı = Image(source='uyarı.png') kutu.add_widget(uyarı) kutu.add_widget(buton) animasyonText = Animation(color=(0, 0, 0, 1)) + Animation(color=(1, 1, 1, 1)) animasyonText.repeat = True # evet seçeneğini sürekli yanıp sönen iki renk yapar animasyonText.start(evet) animasyon = Animation(size=(300, 180), duration=0.2, t='out_back') animasyon.start(açıl) açıl.open() return True
def __init__(self, diameter=150, **kwargs): super(LoadingWidget, self).__init__(**kwargs) self.diameter = diameter anim = Animation(angle=360, duration=1) anim += Animation(angle=360, duration=1) anim.repeat = True anim.start(self) self.draw(0)
def animateBlinking(widget): if widget.animatingBlinkOpacity: return anim = Animation(blinkOpacity=0.1, duration=.25) anim += Animation(blinkOpacity=0.3, duration=.25) anim.repeat = True anim.start(widget) widget.animatingBlinkOpacity = True
def show_second_form(self): self.clear_widgets() self.img = Image(size_hint=(0.5, 0.5), pos_hint={'center_x': 0.5, 'center_y': 0.5}, source='loader.png') self.add_widget(self.img) anim = Animation(angle=-360, duration=2) anim += Animation(angle=-360, duration=2) anim.repeat = True anim.start(self)
def start_animation(self): animation = Animation( duration=1, transition='in_cubic', background_opacity=0.3) + Animation( duration=1, transition='out_cubic', background_opacity=0) animation.repeat = True animation.start(self) self._animation = animation
def animate(self): #ball bounce animation height = 0.2 bally = 0.5 anim2 = Animation(pos_hint={"top": bally + height}, duration=0.5) anim2 += Animation(pos_hint={"top": bally}, t='out_bounce') anim2.repeat = True anim2.start(self.ids.ball)
def test_stop(self): from kivy.animation import Animation from kivy.uix.widget import Widget a = Animation(x=100) + Animation(x=0) a.repeat = True w = Widget() a.start(w) a.stop(w) assert no_animations_being_played()
def __init__(self,**kwargs): Screen.__init__(self,**kwargs) layout = FloatLayout(size=(766,1366)) self.initialising = Label(text = 'Initializing', size_hint =(.1,.01), pos_hint = {'x':.9, 'y':0.02}) initialisingani = Animation(color = (1,1,1,0.1) , d=0.5, t='in_out_quad') + Animation(color = (1,1,1,1), d=0.5, t='in_out_quad') initialisingani.repeat = True initialisingani.start(self.initialising) self.add_widget(self.initialising) self.add_widget(layout)
def on_unit_targeted(self): duration = 3 anim = Animation(**c_hit.rgb_dict, duration=duration / 3) anim += Animation(r=self.r, g=self.g, b=self.b, duration=duration * 2 / 3) anim.repeat = True anim.start(self)
def run(self): """ rozpoczyna zapętloną animacje """ self.instance.rotation.origin = [ self.instance.width / 2, self.instance.height / 2 ] anim = Animation(angle=360, duration=1.5, t='in_cubic') + Animation( angle=0, duration=0) anim.start(self.instance.rotation) anim.repeat = True
def on_shield_targeted(self, shield_index): shield_part = max(self.shields[shield_index], key=lambda k: self.shields[shield_index][k][2]) duration = 3 anim = Animation(**c_hit.rgb_dict, duration=duration / 3) anim += Animation(r=shield_part.r, g=shield_part.g, b=shield_part.b, duration=duration * 2 / 3) anim.repeat = True anim.start(shield_part)
def __init__(self, **kw): super().__init__(**kw) if not Config.get('animations', True): return anim = Animation(d=1) for points in self._border_template: anim += Animation(_border_points=points, d=.3, t='in_out_quint') anim.repeat = True anim.start(self)
def __init__(self, **kwargs): super(SeasonDial, self).__init__(**kwargs) self.dial_file = 'assets/seasons_dial.png' self.dial_size = 0.4, 0.4 self.day_length = 86400 self.set_season_angle() # will this work? anim = Animation(angle=360, duration=self.day_length * 365.25) anim += Animation(angle=360, duration=self.day_length * 365.25) anim.repeat = True anim.start(self)
def show_second_form(self): self.clear_widgets() self.img = Image( size_hint=(0.5, 0.5), pos_hint={"center_x": 0.5, "center_y": 0.5}, source="loader.png", ) self.add_widget(self.img) anim = Animation(angle=-360, duration=2) anim += Animation(angle=-360, duration=2) anim.repeat = True anim.start(self)
def show_info(self, info): if not self.info: anim_bar = Label(text=info, center=self.center, size_hint=(None, None)) anim_bar.size = anim_bar.texture_size anim = Animation(opacity=0.3, duration=0.6) anim += Animation(opacity=1, duration=0.8) anim.repeat = True self.parent.parent.ids['control'].add_widget(anim_bar, -1) anim.start(anim_bar) self.info = anim_bar
def on_wall_targeted(self, wall, targeted): for w in self.walls: if w.origin == wall.origin and w.destination == wall.destination or w.origin == wall.destination and w.destination == wall.origin: if targeted: duration = 3 anim = Animation(**Color.firebrick.rgb_dict, duration=duration / 3) anim += Animation(r=w.r, g=w.g, b=w.b, duration=duration * 2 / 3) anim.repeat = True anim.start(w) else: Animation.cancel_all(w) w.color = w.get_default_color() return
def _init_view(self, *args): is_question = self.popup_alertaction.message.endswith('?') self.ids.alert_msg_yes.size_hint = (1.0, 1.0) if is_question else (0, 0) self.ack_msg = 'NO' if is_question else 'OK' self.ids.alert_container.bind(size=self._update_shape) if self.high_priority: anim = Animation(color=(1, 1, 1, 0), duration=0.2) + Animation(color=(1, 1, 1, 0), duration=0.2) anim += Animation(color=(1, 1, 1, 1), duration=0.2) + Animation(color=(1, 1, 1, 1), duration=0.2) anim.repeat = True anim.start(self.ids.alert_msg) self.anim = anim
def move_text(self, *args): screen = self._app.sm.get_screen('about_screen') text_object = screen.ids['moving_text'] window_x, window_y = Window.size center_x = window_x/2 center_x = 10 center_y = window_y/2 center_y = 10 dia = 200 dur = 3 t = 'in_out_circ' anim = Animation(x=center_x, y=center_y-dia, duration=dur, t=t) + Animation(x=center_x+dia, y=center_y, duration=dur, t=t) + Animation(x=center_x, y=center_y+dia, duration=dur, t=t) + Animation(x=center_x-dia, y=center_y, duration=dur, t=t) anim.repeat = True anim.start(text_object)
def animate(self, instance): # create an animation object. This object could be stored # and reused each call or reused across different widgets. # += is a sequential step, while &= is in parallel #print("hello") animation = Animation(pos=(instance.parent.width - 500, -20), duration=3.) animation = animation + Animation(pos=(0, -20), duration=3.) # apply the animation on the button, passed in the "instance" argument # Notice that default 'click' animation (changing the button # color while the mouse is down) is unchanged. animation.repeat = True animation.start(instance)
def start_test(self, *args): # Remove the button. self.remove_widget(self.but_1) # Update a widget property. self.lab_1.text = ('The UI remains responsive while the ' 'second thread is running.') # Create and add a new widget. anim_bar = Factory.AnimWidget() self.anim_box.add_widget(anim_bar) # Animate the added widget. anim = Animation(opacity=0.3, width=100, duration=0.6) anim += Animation(opacity=1, width=400, duration=0.8) anim.repeat = True anim.start(anim_bar)
def init_display(self): """ Initialize the display """ self.album_image.source = self.ctrl.get_current_art() info = self.ctrl.get_current_info() if info: self.info_label1.text = info["artist"] self.info_label2.text = info["album"] self.info_label3.text = info["file"] from kivy.animation import Animation t = 'in_out_circ' anims = Animation(rotate=(360.0, 1, 0, 0), duration=5, t=t) + \ Animation(rotate=(0.0, 1, 0, 0), duration=5, t=t) + \ Animation(rotate=(360.0, 0, 1, 0), duration=5, t=t) + \ Animation(rotate=(0.0, 0, 1, 0), duration=5, t=t) anims.repeat = True anims.start(self.ids.node)
def build(self): self.root = root = Builder.load_string(''' PandaView: cam_pos: 0, -8, .5 ''') self.model = root.load_model('Kivy.egg') root.msb.setBackgroundColor(0, 0, 0, 0) anim = Animation( angle=359, d=3 ) + Animation( angle=0, d=0 ) anim.repeat = True anim.start(self) return root
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) anim = Animation(angle=-360, d=1, t='in_out_cubic') anim += Animation(angle=0, d=0) anim.repeat = True anim.start(self)
Button: markup: True text: "%s"%(icon('icon-doc-text-inv', 64, 'ff3333')) Label: id: _anim markup: True text: "%s"%(icon('icon-spin6', 32)) font_color: 1, 0, 0, 1 p: 0 canvas: Clear PushMatrix Rotate: angle: -self.p origin: self.center_x , self.center_y Rectangle: size: (32, 32) pos: self.center_x - 16, self.center_y - 16 texture: self.texture PopMatrix """ register('default_font', 'iconfont_sample.ttf', 'iconfont_sample.fontd') root = Builder.load_string(kv) an = Animation(p=360, duration=2) + Animation(p=0, duration=0) an.repeat = True an.start(root.ids['_anim']) runTouchApp(root)
def __init__(self, *args, **kwargs): super(EmptyBeer, self).__init__(*args, **kwargs) self.touchable = True anim = Animation(opacity=.7) + Animation(opacity=1) anim.repeat = True anim.start(self)
from kivy.animation import Animation from kivy.base import runTouchApp from kivy.uix.relativelayout import RelativeLayout from resourcebar import ResourceBar if __name__ == '__main__': layout = RelativeLayout() rb = ResourceBar(size_hint=(.6, .2), pos_hint={'center_x': .5, 'center_y': .5}) layout.add_widget(rb) anim1 = Animation(fill_pct=1.) + Animation(fill_pct=0.) anim1.repeat = True anim1.start(rb) anim2 = Animation(slant_pct=-1.) + Animation(slant_pct=1.) anim2.repeat = True anim2.start(rb) runTouchApp(layout)
from kivy.animation import Animation from kivy.base import runTouchApp from foobar import FooBar if __name__ == '__main__': fb = FooBar(pos=(375, 50), size=(100, 500), size_hint=(None, None)) anim = Animation(force=100) + Animation(force=-100) anim.repeat = True anim.start(fb) runTouchApp(fb)