0
これは愚かな質問かもしれませんが、私はどこでも答えを見つけることはできません。Qtは即座にアニメーションを回転させます
QPolygonF triangle;
triangle.append(QPointF(0., -15));
triangle.append(QPointF(30., 0));
triangle.append(QPointF(0., 15));
triangle.append(QPointF(15., 0));
この三角形は、マップ上の車を表すもので、アニメーション化する必要があります。それはそれはそれはそれは次の起こっている道路に直面するように回転させる必要がある交差点(道路クロス)に達すると
QGraphicsItemAnimation *animation;
QGraphicsPolygonItem *clientCar;
QTimeLine *timer;
animation = new QGraphicsItemAnimation;
timer = new QTimeLine(10000);
timer->setFrameRange(0, 100);
clientCar = scene->addPolygon(triangle, myPen, myBrush)
animation->setItem(clientCar);
animation->setTimeLine(10000);
animation->setPosAt(0.f/200.f, map.street1);
animation->setRotationAt(10.f/200.f, 90.f);
animation->setPosAt(10.f/200.f, map.street2);
animation->setRotationAt(20.f/200.f, 180.f);
animation->setPosAt(20.f/200.f, map.street3);
scene->addItem(clientCar);
ui->graphicsView->setScene(scene);
timer->start();
問題は、次のとおりですので、私は次のようでした。上記のように、私はsetRotationAt()を使ってみましたが、次の交差点に到達するまで交差点間をゆっくりと回転しています。それは瞬時に変わっているはずです。変化しているときだけです。どんな助け?ドキュメントから
どうもありがとうございました! –
@ R.Andreiあなたが気にしないなら、私の答えを受け入れてください;) – 0Tech