def EasingData(self, start, distance): ##generate easing steps data current_time = 0.0 start_posx = 0.0 current_posx = start_posx final_posx = float(distance) posx_init = start dur = self._EasingDur last_posx = 0.0 all_last_posx = [] for i in range(0, distance * dur): current_posx = easing.SineIn(current_time, start_posx, final_posx - start_posx, float(dur)) if current_posx >= final_posx: current_posx = final_posx dx = current_posx - last_posx all_last_posx.append(int(dx)) current_time += 1 last_posx = current_posx if current_posx >= final_posx: break c = 0 for i in all_last_posx: c += i if c < final_posx - start_posx: all_last_posx.append(final_posx - c) return all_last_posx
def EasingAllPageRight(self): current_time = 0.0 start_posx = 0.0 current_posx = start_posx final_posx = float(Width) posx_init = 0 dur = 30 last_posx = 0.0 all_last_posx = [] if self._PageIndex <= 0: return for i in range(0, Width * dur): current_posx = easing.SineIn(current_time, start_posx, final_posx - start_posx, float(dur)) if current_posx >= final_posx: current_posx = final_posx dx = current_posx - last_posx all_last_posx.append(int(dx)) current_time += 1 last_posx = current_posx if current_posx >= final_posx: break c = 0 for i in all_last_posx: c += i if c < final_posx - start_posx: all_last_posx.append(final_posx - c) for i in all_last_posx: self.ClearCanvas() for j in reversed(self._Pages): j._PosX += i j.DrawIcons() j._Screen.SwapAndShow() self._Pages[self._PageIndex]._OnShow = False self._PageIndex -= 1 if self._PageIndex < 0: self._PageIndex = 0 self._Pages[self._PageIndex]._OnShow = True self._CurrentPage = self._Pages[self._PageIndex]
def KeyboardShift(self): current_time = 0.0 start_posx = 0.0 current_posx = start_posx final_posx = 320.0 posx_init = 0.0 dur = 30 last_posx = 0.0 all_last_posx = [] for i in range(0, Width * dur): current_posx = easing.SineIn(current_time, start_posx, final_posx - start_posx, float(dur)) if current_posx >= final_posx: current_posx = final_posx dx = current_posx - last_posx all_last_posx.append(int(dx)) current_time += 1 last_posx = current_posx if current_posx >= final_posx: break c = 0 for i in all_last_posx: c += i if c < final_posx - start_posx: all_last_posx.append(final_posx - c) for i in all_last_posx: for j in range(0, self._SectionNumbers): for u in self._SecsKeys[j]: for x in u: x._PosX += self._LeftOrRight * i self.ResetPageSelector() self.ClearCanvas() self.Draw() self._Screen.SwapAndShow()