Guest User

Untitled

a guest
Jul 17th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. def setPos(self, pos):
  2. print('from %s to %s' % (self.scenePos(), pos))
  3. timer = QTimeLine(5000)
  4. timer.setFrameRange(0, 100)
  5. animation = QGraphicsItemAnimation()
  6. animation.setItem(self)
  7. animation.setTimeLine(timer)
  8. x_step = (pos - self.scenePos()).x() / 200
  9. y_step = (pos - self.scenePos()).y() / 200
  10. for i in range(200):
  11. animation.setPosAt(i/200, self.scenePos() + QPointF(i * x_step, i * y_step))
  12. timer.start()
  13.  
  14. QPropertyAnimation * animationPos = new QPropertyAnimation(Object, propertyName);
  15.  
  16. animationPos->setDuration(miliseconds);
  17. animationPos->setStarValue(startValueForProperty);
  18. animationsPos->setEndValue(endValueForProperty);
Add Comment
Please, Sign In to add comment