本文整理汇总了C++中QSequentialAnimationGroup::addPause方法的典型用法代码示例。如果您正苦于以下问题:C++ QSequentialAnimationGroup::addPause方法的具体用法?C++ QSequentialAnimationGroup::addPause怎么用?C++ QSequentialAnimationGroup::addPause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSequentialAnimationGroup
的用法示例。
在下文中一共展示了QSequentialAnimationGroup::addPause方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QGLSceneNode
Tank::Tank(QObject *parent)
: QGLSceneNode(parent)
, m_texture(0)
{
QSequentialAnimationGroup *seq = new QSequentialAnimationGroup(this);
QGraphicsScale3D *scale = new QGraphicsScale3D(this);
addTransform(scale);
QPropertyAnimation *anim = new QPropertyAnimation(scale, "scale");
anim->setDuration(10000);
anim->setStartValue(QVector3D(1.0f, 0.1f, 1.0f));
anim->setEndValue(QVector3D(1.0f, 1.2f, 1.0f));
anim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad));
seq->addAnimation(anim);
seq->addPause(2000);
anim = new QPropertyAnimation(scale, "scale");
anim->setDuration(10000);
anim->setStartValue(QVector3D(1.0f, 1.2f, 1.0f));
anim->setEndValue(QVector3D(1.0f, 0.1f, 1.0f));
anim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad));
seq->addAnimation(anim);
seq->setLoopCount(-1);
seq->start();
addNode(tankObject());
QGLMaterial *mat = qCreateFluid();
m_texture = mat->texture();
setMaterial(mat);
}
示例2: startAlertAnimation
void ContactsViewDelegate::startAlertAnimation()
{
if (!m_alertAnimation)
{
QSequentialAnimationGroup *ag = new QSequentialAnimationGroup(this);
m_alertAnimation = ag;
QPropertyAnimation *aIn = new QPropertyAnimation(this, "alertOpacity");
aIn->setEndValue(qreal(1));
aIn->setEasingCurve(QEasingCurve::OutQuad);
aIn->setDuration(750);
QPropertyAnimation *aOut = new QPropertyAnimation(this, "alertOpacity");
aOut->setEndValue(qreal(0.2));
aOut->setEasingCurve(QEasingCurve::InQuad);
aOut->setDuration(750);
ag->addAnimation(aIn);
ag->addPause(150);
ag->addAnimation(aOut);
ag->setLoopCount(-1);
ag->start();
}
}
示例3: QGraphicsView
//.........这里部分代码省略.........
//! [7]
// Flip animation setup
QPropertyAnimation *smoothFlipRotation = new QPropertyAnimation(flipRotation, "angle");
QPropertyAnimation *smoothFlipScale = new QPropertyAnimation(pad, "scale");
QPropertyAnimation *smoothFlipXRotation = new QPropertyAnimation(xRotation, "angle");
QPropertyAnimation *smoothFlipYRotation = new QPropertyAnimation(yRotation, "angle");
QParallelAnimationGroup *flipAnimation = new QParallelAnimationGroup(this);
smoothFlipScale->setDuration(500);
smoothFlipRotation->setDuration(500);
smoothFlipXRotation->setDuration(500);
smoothFlipYRotation->setDuration(500);
smoothFlipScale->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipXRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipYRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipScale->setKeyValueAt(0, qvariant_cast<qreal>(1.0));
smoothFlipScale->setKeyValueAt(0.5, qvariant_cast<qreal>(0.7));
smoothFlipScale->setKeyValueAt(1, qvariant_cast<qreal>(1.0));
flipAnimation->addAnimation(smoothFlipRotation);
flipAnimation->addAnimation(smoothFlipScale);
flipAnimation->addAnimation(smoothFlipXRotation);
flipAnimation->addAnimation(smoothFlipYRotation);
//! [7]
//! [8]
// Flip animation delayed property assignment
QSequentialAnimationGroup *setVariablesSequence = new QSequentialAnimationGroup;
QPropertyAnimation *setFillAnimation = new QPropertyAnimation(pad, "fill");
QPropertyAnimation *setBackItemVisibleAnimation = new QPropertyAnimation(backItem, "visible");
QPropertyAnimation *setSelectionItemVisibleAnimation = new QPropertyAnimation(selectionItem, "visible");
setFillAnimation->setDuration(0);
setBackItemVisibleAnimation->setDuration(0);
setSelectionItemVisibleAnimation->setDuration(0);
setVariablesSequence->addPause(250);
setVariablesSequence->addAnimation(setBackItemVisibleAnimation);
setVariablesSequence->addAnimation(setSelectionItemVisibleAnimation);
setVariablesSequence->addAnimation(setFillAnimation);
flipAnimation->addAnimation(setVariablesSequence);
//! [8]
//! [9]
// Build the state machine
QStateMachine *stateMachine = new QStateMachine(this);
QState *splashState = new QState(stateMachine);
QState *frontState = new QState(stateMachine);
QHistoryState *historyState = new QHistoryState(frontState);
QState *backState = new QState(stateMachine);
//! [9]
//! [10]
frontState->assignProperty(pad, "fill", false);
frontState->assignProperty(splash, "opacity", 0.0);
frontState->assignProperty(backItem, "visible", false);
frontState->assignProperty(flipRotation, "angle", qvariant_cast<qreal>(0.0));
frontState->assignProperty(selectionItem, "visible", true);
backState->assignProperty(pad, "fill", true);
backState->assignProperty(backItem, "visible", true);
backState->assignProperty(xRotation, "angle", qvariant_cast<qreal>(0.0));
backState->assignProperty(yRotation, "angle", qvariant_cast<qreal>(0.0));
backState->assignProperty(flipRotation, "angle", qvariant_cast<qreal>(180.0));
backState->assignProperty(selectionItem, "visible", false);
stateMachine->addDefaultAnimation(smoothXRotation);
stateMachine->addDefaultAnimation(smoothYRotation);
stateMachine->addDefaultAnimation(smoothXSelection);
stateMachine->addDefaultAnimation(smoothYSelection);
stateMachine->setInitialState(splashState);
//! [10]
示例4: init
void init()
{
Q_Q(KFlipWidget);
flipRotation = new QGraphicsRotation(q);
xRotation = new QGraphicsRotation(q);
yRotation = new QGraphicsRotation(q);
flipRotation->setAxis(Qt::YAxis);
xRotation->setAxis(Qt::YAxis);
yRotation->setAxis(Qt::XAxis);
q->setTransformations(QList<QGraphicsTransform *>() << flipRotation << xRotation << yRotation);
front = new KWidget(q);
back = new KWidget(q);
QSizeF s = q->size();
back->setTransform(QTransform().rotate(180, Qt::YAxis).translate(-s.width(), 0));
smoothFlipRotation = new QPropertyAnimation(flipRotation, "angle");
smoothFlipScale = new QPropertyAnimation(q, "scale");
smoothFlipXRotation = new QPropertyAnimation(xRotation, "angle");
smoothFlipYRotation = new QPropertyAnimation(yRotation, "angle");
flipAnimation = new QParallelAnimationGroup(q);
smoothFlipScale->setDuration(500);
smoothFlipRotation->setDuration(500);
smoothFlipXRotation->setDuration(500);
smoothFlipYRotation->setDuration(500);
smoothFlipScale->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipXRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipYRotation->setEasingCurve(QEasingCurve::InOutQuad);
smoothFlipScale->setKeyValueAt(0, qVariantValue<qreal>(1.0));
smoothFlipScale->setKeyValueAt(0.5, qVariantValue<qreal>(0.7));
smoothFlipScale->setKeyValueAt(1, qVariantValue<qreal>(1.0));
flipAnimation->addAnimation(smoothFlipRotation);
flipAnimation->addAnimation(smoothFlipScale);
flipAnimation->addAnimation(smoothFlipXRotation);
flipAnimation->addAnimation(smoothFlipYRotation);
// Flip animation delayed property assignment
QSequentialAnimationGroup *setVariablesSequence = new QSequentialAnimationGroup;
QPropertyAnimation *setBackItemVisibleAnimation = new QPropertyAnimation(back, "visible");
QPropertyAnimation *setSelectionItemVisibleAnimation = new QPropertyAnimation(front, "visible");
setBackItemVisibleAnimation->setDuration(0);
setSelectionItemVisibleAnimation->setDuration(0);
setVariablesSequence->addPause(250);
setVariablesSequence->addAnimation(setBackItemVisibleAnimation);
setVariablesSequence->addAnimation(setSelectionItemVisibleAnimation);
flipAnimation->addAnimation(setVariablesSequence);
// Build the state machine
stateMachine = new QStateMachine(q);
frontState = new QState(stateMachine);
backState = new QState(stateMachine);
frontState->assignProperty(back, "visible", false);
frontState->assignProperty(flipRotation, "angle", qVariantValue<qreal>(0.0));
frontState->assignProperty(front, "visible", true);
backState->assignProperty(back, "visible", true);
backState->assignProperty(xRotation, "angle", qVariantValue<qreal>(0.0));
backState->assignProperty(yRotation, "angle", qVariantValue<qreal>(0.0));
backState->assignProperty(flipRotation, "angle", qVariantValue<qreal>(180.0));
backState->assignProperty(front, "visible", false);
stateMachine->setInitialState(frontState);
frontTransition = new QSignalTransition(q, SIGNAL(activeBack()), frontState);
backTransition = new QSignalTransition(q, SIGNAL(activeFront()), backState);
frontTransition->addAnimation(flipAnimation);
backTransition->addAnimation(flipAnimation);
frontTransition->setTargetState(backState);
backTransition->setTargetState(frontState);
bool bok = QObject::connect(flipAnimation, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)), q, SLOT(on_animation_stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
bool bok1 = QObject::connect(flipAnimation, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)), q, SLOT(on_animation_stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
stateMachine->start();
}