def anim_scale(item, scale, on_progress=None, on_complete=None): Animation.stop_all(item) anim = Animation(scale=scale, duration=.2) if on_progress != None: anim.on_progress = on_progress if on_complete: anim.on_complete = on_complete anim.start(item)
def gen_ob_slang(self): self.ids.test.source = 'sun3334.png' anim = Animation(angle=360, duration=0.5) anim += Animation(angle=360, duration=0.5) anim.start(self) anim.on_progress = self.empty anim.on_complete = self.eliteeng_slova self.ubrat() self.which_sound()
def on_touch_up(self, touch): """Base kivy method inherited from Button. This method is called on all buttons at once, so we need to return True for only the *originally* touched button. Note: We are not currently passing this up to super(), but we could consider doing so. Args: touch: A kivy motion event Returns: True if for *originally* touched button, False otherwise. """ if touch.is_touch or touch.button == 'left': if touch.grab_current is self: word = _Board.complete # clear word complete text _Board.complete = '_ _ _' # release grab touch.ungrab(self) # only check word if on playArea if _Board._dictionary.lookup(word) and \ _Board.collide_point(touch.x, touch.y) \ and _Board._highlighted: # add bubble points indicator bubble = _Board.footer.bubble # get the last element added to highlighted last = next(reversed(_Board._highlighted)) bubble.pos = last.pos bubble.text = _Board.header.word_complete.bubble.text[:] bubble.score = int(_Board.value) score_board = _Board.header.lheader.score timer = _Board.game_timer move_bubble = Animation(pos=(timer.x + 30, timer.y - 20), \ t='in_expo', d = 0.7) move_bubble += Animation(pos=(score_board.x + 50, score_board.y), \ t='in_out_elastic', d = 0.3) move_bubble.on_progress = self.mid_bubble move_bubble.on_complete = self.done_bubble move_bubble.start(bubble) # mark score bubble as in-progress bubble.working = 1 affected_columns = set() # find columns with tiles to remove for tile in _Board._highlighted: affected_columns.add(tile.parent) Tile.replace_tiles(set(_Board._highlighted), affected_columns) _Board._highlighted.clear() else: #clear word complete point bubble _Board.value = 0 # clear highlight for tile in _Board._highlighted: tile.background_color = [1,1,1,1] # clear highlighted list _Board._highlighted.clear() return True return False