|
QGraphicsItemAnimation::SetPosAt( qreal step, const QPointF & point )怎么使用?Step怎么设置?想用QGraphicsItemAnimation做一个匀速直线 运动 的动画!把一个QGraphicsItem从QGraphicsScene 的(850,170)匀速移动到(200,170)。现在实现方法主要参考帮助文档里的那个 具体如下:- QGraphicsItem *ball = new QGraphicsEllipseItem(0, 0, 20, 20);
- ball->setpos(850,170);
- QTimeLine *timer = new QTimeLine(5000);
- timer->setFrameRange(0, 100);
- QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
- animation->setItem(ball);animation->setTimeLine(timer);
- animation->setPosAt(0.5, QPointF(200, 170));
这样的虽然是直线运动,但不是匀速的。请高手帮解答!小弟谢谢了!
|