当前位置: 首页>>代码示例>>Python>>正文


Python Arrow.set_time_at_speed方法代码示例

本文整理汇总了Python中arrow.Arrow.set_time_at_speed方法的典型用法代码示例。如果您正苦于以下问题:Python Arrow.set_time_at_speed方法的具体用法?Python Arrow.set_time_at_speed怎么用?Python Arrow.set_time_at_speed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在arrow.Arrow的用法示例。


在下文中一共展示了Arrow.set_time_at_speed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Slide

# 需要导入模块: from arrow import Arrow [as 别名]
# 或者: from arrow.Arrow import set_time_at_speed [as 别名]
class Slide(UserState):
  def __init__(self, app, hand, time=max_slide_wait, arrow=None):
    UserState.__init__(self, app, hand.user)
    self.hand = hand
    self.start_time = clock()
    self.time = time

    base.slide(hand.side_sign)

    self.arrow = arrow
    if not self.arrow:
      self.arrow = Arrow(self.app, hand.user, hand.side)
      self.arrow.play_trigger()
    self.arrow.update(base.nui.users)

    print 'time', time
    self.timer(time, self.timeout)

  def hand_move(self, hand):
    if hand.side == self.hand.side and not self.arrow.is_playing:
      max_extension = 0.55
      pos = hand.positions[-1].x * hand.side_sign
      time = max(0.0, min(1.0, (pos - hand_trigger) / (max_extension - hand_trigger)))
      self.time = max_slide_wait - time * (max_slide_wait - min_slide_wait)
      self.timer(self.time - (clock()-self.start_time), self.timeout)
      self.arrow.set_time_at_speed(time)
    self.arrow.update(base.nui.users)
    UserState.hand_move(self, hand)

  def hand_in(self, hand):
    if hand.side != self.hand.side:
      self.arrow.destroy()
      self.next_state(Thumbnails(self.app, self.hand.user))

  def hand_out(self, hand):
    if hand.side == self.hand.side:
      self.arrow.destroy()
      self.next_state(Start(self.app))

  def lost_user(self):
    self.arrow.destroy()

  def timeout(self):
    self.next_state(Slide(self.app, self.hand, self.time, self.arrow))
开发者ID:outbox,项目名称:Galia,代码行数:46,代码来源:states.py


注:本文中的arrow.Arrow.set_time_at_speed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。