Пример #1
0
def doAnimations(dt):
  global animateSchedules
  framerate = Nodes.canvas.framerate
  
  for key in animateSchedules.keys():
    a = animateSchedules[key] 
    
    #if we finished last time around, set the final value if nescessary
    #and erase the animation
    if a.finished:
      if a.what[a.attrname] != a.targetValue:
        a.what[a.attrname] = a.targetValue
      del animateSchedules[key]
      continue   
    
    #exactly how far to move this frame.
    inc = (a.inc*dt)
    
    #if we are going up, test for end
    if a.goingUp:
      #are we at or near enough target value?
      if a.targetValue <= a.what[a.attrname]+inc: 
        a.finished = True
        continue
      
    #if we are going down, test for end
    else:
      #are we at or near enough target value?
      if a.targetValue >= a.what[a.attrname]+inc: 
        a.finished = True
        continue
  
    #move the object, now adjusted for how much time elapsed to make nice animations
    a.what[a.attrname] += inc
    
    if ['x', 'y', 'width', 'height'].count(a.attrname):
      v = ViewProjector.viewToVertice(a.what.x, a.what.y, a.what.width, a.what.height)  
      ViewProjector.self.quads[a.what.viewindex].vertices = v