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


C++ QGraphicsItemAnimation::setRotationAt方法代码示例

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


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

示例1: checkReturnedLists

void tst_QGraphicsItemAnimation::checkReturnedLists()
{
    QGraphicsItemAnimation animation;

    animation.setPosAt(1.0, QPointF(10, -10));
    animation.setPosAt(0.5, QPointF(5, -5));

    animation.setRotationAt(0.3, 2.3);
    animation.setTranslationAt(0.3, 15, 15);
    animation.setScaleAt(0.3, 2.5, 1.8);
    animation.setShearAt(0.3, 5, 5);

    QCOMPARE(animation.posList().at(0), (QPair<qreal, QPointF>(0.5, QPointF(5, -5))));
    QCOMPARE(animation.posList().at(1), (QPair<qreal, QPointF>(1.0, QPointF(10, -10))));
    QCOMPARE(animation.rotationList().at(0), (QPair<qreal, qreal>(0.3, 2.3)));
    QCOMPARE(animation.translationList().at(0), (QPair<qreal, QPointF>(0.3, QPointF(15, 15))));
    QCOMPARE(animation.scaleList().at(0), (QPair<qreal, QPointF>(0.3, QPointF(2.5, 1.8))));
    QCOMPARE(animation.shearList().at(0), (QPair<qreal, QPointF>(0.3, QPointF(5, 5))));

    QCOMPARE(animation.posList().size(), 2);
    QCOMPARE(animation.rotationList().size(), 1);
    QCOMPARE(animation.translationList().size(), 1);
    QCOMPARE(animation.scaleList().size(), 1);
    QCOMPARE(animation.shearList().size(), 1);
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:25,代码来源:tst_qgraphicsitemanimation.cpp

示例2: linearRotation

void tst_QGraphicsItemAnimation::linearRotation()
{
    QGraphicsItemAnimation animation;
    animation.setRotationAt(1, 1);

    for (int i = 0; i <= 10; ++i)
        QCOMPARE(animation.rotationAt(i / 10.0), qreal(i / 10.0));
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:8,代码来源:tst_qgraphicsitemanimation.cpp

示例3: newAnim

QTimeLine* newAnim(Line* ball, int in, int to, QEasingCurve curve)
{
    QTimeLine *NewTimer = new QTimeLine(speed);
    NewTimer->setEasingCurve(curve);

    QGraphicsItemAnimation* anim = new QGraphicsItemAnimation();
    anim->setItem(ball);
    anim->setTimeLine(NewTimer);
    anim->setRotationAt(0, in);
    anim->setRotationAt(1, to);

    return NewTimer;
}
开发者ID:Xambey,项目名称:learning,代码行数:13,代码来源:main.cpp

示例4: overwriteValueForStep

void tst_QGraphicsItemAnimation::overwriteValueForStep()
{
    QGraphicsItemAnimation animation;

    for (int i=0; i<3; i++){
        animation.setPosAt(0.3, QPointF(3, -3.1));
        animation.setRotationAt(0.3, 2.3);
        animation.setTranslationAt(0.3, 15, 15);
        animation.setScaleAt(0.3, 2.5, 1.8);
        animation.setShearAt(0.3, 5, 5);

        QCOMPARE(animation.posList().size(), 1);
        QCOMPARE(animation.rotationList().size(), 1);
        QCOMPARE(animation.translationList().size(), 1);
        QCOMPARE(animation.scaleList().size(), 1);
        QCOMPARE(animation.shearList().size(), 1);
    }
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:18,代码来源:tst_qgraphicsitemanimation.cpp

示例5: RobotTorso

Robot::Robot()
{
    QGraphicsItem *torsoItem = new RobotTorso(this);    
    QGraphicsItem *headItem = new RobotHead(torsoItem);
    QGraphicsItem *upperLeftArmItem = new RobotLimb(torsoItem);
    QGraphicsItem *lowerLeftArmItem = new RobotLimb(upperLeftArmItem);
    QGraphicsItem *upperRightArmItem = new RobotLimb(torsoItem);
    QGraphicsItem *lowerRightArmItem = new RobotLimb(upperRightArmItem);
    QGraphicsItem *upperRightLegItem = new RobotLimb(torsoItem);
    QGraphicsItem *lowerRightLegItem = new RobotLimb(upperRightLegItem);
    QGraphicsItem *upperLeftLegItem = new RobotLimb(torsoItem);
    QGraphicsItem *lowerLeftLegItem = new RobotLimb(upperLeftLegItem);
    
    headItem->setPos(0, -18);
    upperLeftArmItem->setPos(-15, -10);
    lowerLeftArmItem->setPos(30, 0);
    upperRightArmItem->setPos(15, -10);
    lowerRightArmItem->setPos(30, 0);
    upperRightLegItem->setPos(10, 32);
    lowerRightLegItem->setPos(30, 0);
    upperLeftLegItem->setPos(-10, 32);
    lowerLeftLegItem->setPos(30, 0);

    timeLine = new QTimeLine;

    QGraphicsItemAnimation *headAnimation = new QGraphicsItemAnimation;
    headAnimation->setItem(headItem);
    headAnimation->setTimeLine(timeLine);
    headAnimation->setRotationAt(0, 20);
    headAnimation->setRotationAt(1, -20);
    headAnimation->setScaleAt(1, 1.1, 1.1);

    QGraphicsItemAnimation *upperLeftArmAnimation = new QGraphicsItemAnimation;
    upperLeftArmAnimation->setItem(upperLeftArmItem);
    upperLeftArmAnimation->setTimeLine(timeLine);
    upperLeftArmAnimation->setRotationAt(0, 190);
    upperLeftArmAnimation->setRotationAt(1, 180);

    QGraphicsItemAnimation *lowerLeftArmAnimation = new QGraphicsItemAnimation;
    lowerLeftArmAnimation->setItem(lowerLeftArmItem);
    lowerLeftArmAnimation->setTimeLine(timeLine);
    lowerLeftArmAnimation->setRotationAt(0, 50);
    lowerLeftArmAnimation->setRotationAt(1, 10);
    
    QGraphicsItemAnimation *upperRightArmAnimation = new QGraphicsItemAnimation;
    upperRightArmAnimation->setItem(upperRightArmItem);
    upperRightArmAnimation->setTimeLine(timeLine);
    upperRightArmAnimation->setRotationAt(0, 300);
    upperRightArmAnimation->setRotationAt(1, 310);

    QGraphicsItemAnimation *lowerRightArmAnimation = new QGraphicsItemAnimation;
    lowerRightArmAnimation->setItem(lowerRightArmItem);
    lowerRightArmAnimation->setTimeLine(timeLine);
    lowerRightArmAnimation->setRotationAt(0, 0);
    lowerRightArmAnimation->setRotationAt(1, -70);

    QGraphicsItemAnimation *upperLeftLegAnimation = new QGraphicsItemAnimation;
    upperLeftLegAnimation->setItem(upperLeftLegItem);
    upperLeftLegAnimation->setTimeLine(timeLine);
    upperLeftLegAnimation->setRotationAt(0, 150);
    upperLeftLegAnimation->setRotationAt(1, 80);

    QGraphicsItemAnimation *lowerLeftLegAnimation = new QGraphicsItemAnimation;
    lowerLeftLegAnimation->setItem(lowerLeftLegItem);
    lowerLeftLegAnimation->setTimeLine(timeLine);
    lowerLeftLegAnimation->setRotationAt(0, 70);
    lowerLeftLegAnimation->setRotationAt(1, 10);

    QGraphicsItemAnimation *upperRightLegAnimation = new QGraphicsItemAnimation;
    upperRightLegAnimation->setItem(upperRightLegItem);
    upperRightLegAnimation->setTimeLine(timeLine);
    upperRightLegAnimation->setRotationAt(0, 40);
    upperRightLegAnimation->setRotationAt(1, 120);
    
    QGraphicsItemAnimation *lowerRightLegAnimation = new QGraphicsItemAnimation;
    lowerRightLegAnimation->setItem(lowerRightLegItem);
    lowerRightLegAnimation->setTimeLine(timeLine);
    lowerRightLegAnimation->setRotationAt(0, 10);
    lowerRightLegAnimation->setRotationAt(1, 50);
    
    QGraphicsItemAnimation *torsoAnimation = new QGraphicsItemAnimation;
    torsoAnimation->setItem(torsoItem);
    torsoAnimation->setTimeLine(timeLine);
    torsoAnimation->setRotationAt(0, 5);
    torsoAnimation->setRotationAt(1, -20);

    timeLine->setUpdateInterval(1000 / 25);
    timeLine->setCurveShape(QTimeLine::SineCurve);
    timeLine->setLoopCount(0);
    timeLine->setDuration(2000);
    timeLine->start();
}
开发者ID:eagafonov,项目名称:qtmoko,代码行数:92,代码来源:robot.cpp


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