本文整理汇总了C++中QPropertyAnimation::setEasingCurve方法的典型用法代码示例。如果您正苦于以下问题:C++ QPropertyAnimation::setEasingCurve方法的具体用法?C++ QPropertyAnimation::setEasingCurve怎么用?C++ QPropertyAnimation::setEasingCurve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation::setEasingCurve方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: appear
void LinkSelectionItem::appear(const QPointF& animStartPos, const QRectF& linkRect)
{
QGraphicsBlurEffect* blur = new QGraphicsBlurEffect();
blur->setBlurHints(QGraphicsBlurEffect::PerformanceHint);
blur->setBlurRadius(15);
setGraphicsEffect(blur);
QPropertyAnimation* rectAnimation = new QPropertyAnimation(this, "rect");
rectAnimation->setDuration(s_appearAnimDuration);
rectAnimation->setStartValue(QRectF(animStartPos, QSize(3, 3)));
rectAnimation->setEndValue(linkRect);
rectAnimation->setEasingCurve(QEasingCurve::OutExpo);
QPropertyAnimation* opacityAnimation = new QPropertyAnimation(this, "opacity");
opacityAnimation->setDuration(s_disappearAnimDuration);
opacityAnimation->setStartValue(s_linkOpacity);
opacityAnimation->setEndValue(0.0);
opacityAnimation->setEasingCurve(QEasingCurve::InExpo);
m_linkSelectiogroup.addAnimation(rectAnimation);
m_linkSelectiogroup.addAnimation(opacityAnimation);
m_linkSelectiogroup.start();
}
示例2: start
void KItemListViewAnimation::start(QGraphicsWidget* widget, AnimationType type, const QVariant& endValue)
{
stop(widget, type);
QPropertyAnimation* propertyAnim = nullptr;
const int animationDuration = widget->style()->styleHint(QStyle::SH_Widget_Animate) ? 200 : 1;
switch (type) {
case MovingAnimation: {
const QPointF newPos = endValue.toPointF();
if (newPos == widget->pos()) {
return;
}
propertyAnim = new QPropertyAnimation(widget, "pos");
propertyAnim->setDuration(animationDuration);
propertyAnim->setEndValue(newPos);
break;
}
case CreateAnimation: {
propertyAnim = new QPropertyAnimation(widget, "opacity");
propertyAnim->setEasingCurve(QEasingCurve::InQuart);
propertyAnim->setDuration(animationDuration);
propertyAnim->setStartValue(0.0);
propertyAnim->setEndValue(1.0);
break;
}
case DeleteAnimation: {
propertyAnim = new QPropertyAnimation(widget, "opacity");
propertyAnim->setEasingCurve(QEasingCurve::OutQuart);
propertyAnim->setDuration(animationDuration);
propertyAnim->setStartValue(1.0);
propertyAnim->setEndValue(0.0);
break;
}
case ResizeAnimation: {
const QSizeF newSize = endValue.toSizeF();
if (newSize == widget->size()) {
return;
}
propertyAnim = new QPropertyAnimation(widget, "size");
propertyAnim->setDuration(animationDuration);
propertyAnim->setEndValue(newSize);
break;
}
default:
break;
}
Q_ASSERT(propertyAnim);
connect(propertyAnim, &QPropertyAnimation::finished, this, &KItemListViewAnimation::slotFinished);
m_animation[type].insert(widget, propertyAnim);
propertyAnim->start();
}
示例3: initShowHideAnimation
void DockPanel::initShowHideAnimation()
{
QStateMachine * machine = new QStateMachine(this);
QState * showState = new QState(machine);
showState->assignProperty(this,"y", 0);
QState * hideState = new QState(machine);
//y should change with DockMode changed
connect(this, &DockPanel::startHide, [=]{
hideState->assignProperty(this,"y", m_dockModeData->getDockHeight());
});
machine->setInitialState(showState);
QPropertyAnimation *showAnimation = new QPropertyAnimation(this, "y");
showAnimation->setDuration(SHOW_ANIMATION_DURATION);
showAnimation->setEasingCurve(SHOW_EASINGCURVE);
connect(showAnimation,&QPropertyAnimation::finished,this,&DockPanel::onShowPanelFinished);
QPropertyAnimation *hideAnimation = new QPropertyAnimation(this, "y");
hideAnimation->setDuration(HIDE_ANIMATION_DURATION);
hideAnimation->setEasingCurve(HIDE_EASINGCURVE);
connect(hideAnimation,&QPropertyAnimation::finished,this,&DockPanel::onHidePanelFinished);
QSignalTransition *st = showState->addTransition(this,SIGNAL(startHide()), hideState);
st->addAnimation(hideAnimation);
QSignalTransition *ht = hideState->addTransition(this,SIGNAL(startShow()),showState);
ht->addAnimation(showAnimation);
machine->start();
}
示例4: showBlock
void HideBlock::showBlock()
{
if(block->isVisible())
{
btnTitle->setIcon(QIcon(":/img/down.png"));
QPropertyAnimation *animation = new QPropertyAnimation(block,"maximumHeight");
animation->setDuration(350);
animation->setEasingCurve(QEasingCurve::OutCirc);
animation->setStartValue(blockHeight);
animation->setEndValue(0);
animation->start();
connect(animation,SIGNAL(finished()),block,SLOT(hide()));
}
else
{
block->show();
btnTitle->setIcon(QIcon(":/img/up.png"));
QPropertyAnimation *animation = new QPropertyAnimation(block,"maximumHeight");
animation->setDuration(500);
animation->setEasingCurve(QEasingCurve::InCirc);
animation->setStartValue(0);
animation->setEndValue(blockHeight+10000);
animation->start();
}
}
示例5: on_showHidePushButton_clicked
/**
* @brief Shows or hides the right menu with an animation
* according to the value of \ref _rightMenuHidden attribute.
*/
void MainWindow::on_showHidePushButton_clicked()
{
QPropertyAnimation * animation = new QPropertyAnimation(ui->rightMenuWidget, "maximumWidth");
animation->setDuration(1000);
animation->setStartValue(ui->rightMenuWidget->maximumWidth());
if(!_rightMenuHidden) {
ui->showHidePushButton->setIcon(QIcon(":/icons/2left"));
animation->setEndValue(0);
animation->setEasingCurve(QEasingCurve::InBack);
_rightMenuHidden = true;
}
else {
animation->setEndValue(314);
animation->setEasingCurve(QEasingCurve::OutBack);
ui->showHidePushButton->setIcon(QIcon(":/icons/2right"));
_rightMenuHidden = false;
}
animation->start(QPropertyAnimation::DeleteWhenStopped);
}
示例6: 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);
}
示例7: startingAnimation
void CMainWindow::startingAnimation()
{
setWindowFlags(Qt::Window | Qt::FramelessWindowHint); //FramelessWindowHint wymagane do przezroczystego t³a
setAttribute(Qt::WA_TranslucentBackground, true);
QRect screenRect = QApplication::desktop()->screenGeometry();
QSequentialAnimationGroup *group = new QSequentialAnimationGroup(this);
QPropertyAnimation* fadeIn = new QPropertyAnimation(this, "windowOpacity", this);
fadeIn->setDuration(2000);
fadeIn->setStartValue(0.0);
fadeIn->setEndValue(1.0);
group->addAnimation(fadeIn);
QParallelAnimationGroup *moveGroup = new QParallelAnimationGroup(this);
QPropertyAnimation* imageRight = new QPropertyAnimation(pandemicImage, "geometry", this);
imageRight->setStartValue(pandemicImage->geometry());
imageRight->setEndValue(pandemicImage->geometry().translated(screenRect.width() - pandemicImage->geometry().right(), 0));
imageRight->setDuration(1000);
imageRight->setEasingCurve(QEasingCurve::InOutCubic);
moveGroup->addAnimation(imageRight);
QPropertyAnimation* menuLeft = new QPropertyAnimation(menu, "geometry", this);
menuLeft->setStartValue(menu->geometry());
menuLeft->setEndValue(QRect(0,0, screenRect.width()-pandemicImage->width()+1, menu->height()));
menuLeft->setDuration(1000);
menuLeft->setEasingCurve(QEasingCurve::InOutCubic);
moveGroup->addAnimation(menuLeft);
group->addAnimation(moveGroup);
group->start();
connect(group, &QSequentialAnimationGroup::finished, [this]() {
content->setObjectName("body");
});
}
示例8: QParallelAnimationGroup
void QtMaemo6MenuProxy::hideWindow() {
const MWidgetFadeAnimationStyle *fadeOutStyle =
static_cast<const MWidgetFadeAnimationStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Active,
"MWidgetFadeAnimationStyle", "Out"));
QRect startGeometry = m_menu->geometry();
QRect finalGeometry = startGeometry;
finalGeometry.moveTo(finalGeometry.x(), finalGeometry.y() - finalGeometry.height());
QParallelAnimationGroup* animationGroup = new QParallelAnimationGroup();
QPropertyAnimation *widgetFadeOut = new QPropertyAnimation(animationGroup);
widgetFadeOut->setTargetObject(m_menu);
widgetFadeOut->setPropertyName("geometry");
widgetFadeOut->setDuration(fadeOutStyle->duration());
widgetFadeOut->setEasingCurve(fadeOutStyle->easingCurve());
widgetFadeOut->setStartValue(startGeometry);
widgetFadeOut->setEndValue(finalGeometry);
QPalette startPalette = m_appArea->palette();
QPalette finalPalette = startPalette;
startPalette.setBrush(QPalette::Window, QBrush(QColor(0, 0, 0, 0)));
QPropertyAnimation *backgroundFadeOut = new QPropertyAnimation(animationGroup);
backgroundFadeOut->setTargetObject(m_appArea);
backgroundFadeOut->setPropertyName("palette");
backgroundFadeOut->setDuration(fadeOutStyle->duration());
backgroundFadeOut->setEasingCurve(fadeOutStyle->easingCurve());
backgroundFadeOut->setStartValue(startPalette);
backgroundFadeOut->setEndValue(finalPalette);
connect(animationGroup, SIGNAL(finished()), this, SLOT(close()));
animationGroup->start(QAbstractAnimation::DeleteWhenStopped);
}
示例9: animateNextEpisode
void UnseenEpisodeWidget::animateNextEpisode()
{
_currentWidget->setEnabled(false);
_nextWidget = _makeWidget();
if (_nextWidget) {
layout()->addWidget(_nextWidget);
_currentWidget->setMinimumWidth(_currentWidget->width());
_nextWidget->setMinimumWidth(_currentWidget->width());
QPoint finalPos = _currentWidget->pos();
int duration = 600;
QPropertyAnimation *slideOut = new QPropertyAnimation(_currentWidget, "pos", this);
slideOut->setDuration(duration);
slideOut->setStartValue(finalPos);
slideOut->setEndValue(QPoint(finalPos.x() - _currentWidget->width(), finalPos.y()));
slideOut->setEasingCurve(QEasingCurve::OutQuart);
QPropertyAnimation *slideIn = new QPropertyAnimation(_nextWidget, "pos", this);
slideIn->setDuration(duration);
slideIn->setStartValue(QPoint(finalPos.x() + _currentWidget->width(), finalPos.y()));
slideIn->setEndValue(finalPos);
slideIn->setEasingCurve(QEasingCurve::OutQuart);
QParallelAnimationGroup *group = new QParallelAnimationGroup(_currentWidget);
group->addAnimation(slideOut);
group->addAnimation(slideIn);
group->start(QAbstractAnimation::DeleteWhenStopped);
group->connect(group, SIGNAL(finished()), this, SLOT(setupNewCurrent()));
}
}
示例10: startAt
void ReticleItem::startAt(const QPoint& pos)
{
if (m_animation)
m_animation->stop();
setPos(pos.x(), pos.y());
setVisible(true);
setOpacity(1);
setScale(1);
QPropertyAnimation* opacityAnimation = new QPropertyAnimation(this, "opacity");
opacityAnimation->setDuration(AS(reticleDuration));
opacityAnimation->setStartValue(1.0);
opacityAnimation->setEndValue(0.0);
opacityAnimation->setEasingCurve(AS_CURVE(reticleCurve));
QPropertyAnimation* scaleAnimation = new QPropertyAnimation(this, "scale");
scaleAnimation->setDuration(AS(reticleDuration));
scaleAnimation->setStartValue(1.0);
scaleAnimation->setEndValue(1.5);
scaleAnimation->setEasingCurve(AS_CURVE(reticleCurve));
QParallelAnimationGroup* reticleAnimation = new QParallelAnimationGroup;
reticleAnimation->addAnimation(opacityAnimation);
reticleAnimation->addAnimation(scaleAnimation);
QPropertyAnimation* visibility = new QPropertyAnimation(this, "visible");
visibility->setEndValue(false);
visibility->setDuration(0);
m_animation = new QSequentialAnimationGroup;
m_animation->addAnimation(reticleAnimation);
m_animation->addAnimation(visibility);
m_animation->start(QAbstractAnimation::DeleteWhenStopped);
}
示例11: QPropertyAnimation
void
StatsGauge::setValue( int v )
{
if ( maximum() == 0 || v == 0 )
return;
if ( v == m_targetValue )
return;
m_targetValue = v;
{
QPropertyAnimation* a = new QPropertyAnimation( (QProgressBar*)this, "value" );
a->setEasingCurve( QEasingCurve( QEasingCurve::OutQuad ) );
a->setStartValue( value() > 0 ? value() : 1 );
a->setEndValue( v );
a->setDuration( 2000 );
connect( a, SIGNAL( finished() ), a, SLOT( deleteLater() ) );
a->start();
}
{
QPropertyAnimation* a = new QPropertyAnimation( (QProgressBar*)this, "percentage" );
a->setEasingCurve( QEasingCurve( QEasingCurve::OutQuad ) );
a->setStartValue( (float)0 );
a->setEndValue( (float)v / (float)maximum() );
a->setDuration( 2000 );
connect( a, SIGNAL( finished() ), a, SLOT( deleteLater() ) );
a->start();
}
}
示例12: setPrepareAddedToWindowManager
void DockModeWindow::setPrepareAddedToWindowManager() {
m_prepareAddedToWm = true;
if (G_LIKELY(s_dockGlow == 0)) {
QString path(Settings::LunaSettings()->lunaSystemResourcesPath.c_str());
path.append("/dockmode/dock-loading-glow.png");
s_dockGlow = new QPixmap(path);
if(s_dockGlow)
s_dockGlowRefCount++;
if (!s_dockGlow || s_dockGlow->isNull()) {
g_critical("%s: Failed to load image '%s'", __PRETTY_FUNCTION__, qPrintable(path));
}
} else {
s_dockGlowRefCount++;
}
ApplicationDescription* appDesc = static_cast<Window*>(this)->appDescription();
int size = Settings::LunaSettings()->splashIconSize;
m_icon.load(appDesc->splashIconName().c_str());
if (!m_icon.isNull()) {
// scale splash icon to fit the devices screen dimensions
m_icon = m_icon.scaled(size, size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
else {
// just use the launcher icon
m_icon = appDesc->getDefaultLaunchPoint()->icon();
int newWidth = qMin((int)(m_icon.width()*1.5), size);
int newHeight = qMin((int)(m_icon.height()*1.5), size);
m_icon = m_icon.scaled(newWidth, newHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
// set up the pulsing animation
QPropertyAnimation* pulseIn = new QPropertyAnimation(this, "pulseOpacity");
pulseIn->setDuration(AS(cardLoadingPulseDuration));
pulseIn->setEasingCurve(AS_CURVE(cardLoadingPulseCurve));
pulseIn->setEndValue(1.0);
QPropertyAnimation* pulseOut = new QPropertyAnimation(this, "pulseOpacity");
pulseOut->setDuration(AS(cardLoadingPulseDuration));
pulseOut->setEasingCurve(AS_CURVE(cardLoadingPulseCurve));
pulseOut->setEndValue(0.0);
QSequentialAnimationGroup* pulseGroup = new QSequentialAnimationGroup;
pulseGroup->addAnimation(pulseIn);
pulseGroup->addAnimation(pulseOut);
pulseGroup->setLoopCount(-1);
m_pulseAnimation.addPause(AS(cardLoadingTimeBeforeShowingPulsing));
m_pulseAnimation.addAnimation(pulseGroup);
m_loadingOverlayEnabled = true;
m_pulseAnimation.start();
update();
}
示例13: slideUsbSeclect
void DProgressFrame::slideUsbSeclect() {
if (m_Active) {
return;
}
else {
m_Active=true;
}
this->layout()->setEnabled(false);
m_TopShadow->show();
m_ProcessLabel->setPixmap(QPixmap(""));
emit changedUsbSeclet();
int offsetx=frameRect().width(); //inherited from mother
int offsety=frameRect().height();//inherited from mother
m_SecondWidget->setGeometry(0, 0, offsetx, offsety);
offsetx=0;
//offsety=offsety;
//re-position the next widget outside/aside of the display area
QPoint pnext=m_SecondWidget->pos();
QPoint pnow=m_FirstWidget->pos();
m_FirstWidget->move(pnow.x(), pnow.y()- offsety + 64+ 36);
m_SecondWidget->move(pnext.x(), pnext.y() + 64+ 36);
//make it visible/show
m_SecondWidget->show();
m_SecondWidget->raise();
m_TopShadow->raise();
//animate both, the now and next widget to the side, using movie framework
QPropertyAnimation *animnow = new QPropertyAnimation(m_FirstWidget, "pos");
animnow->setDuration(m_Speed);
animnow->setEasingCurve(QEasingCurve::OutBack);
animnow->setStartValue(QPoint(pnow.x(), pnow.y()));
animnow->setEndValue(QPoint(offsetx+pnow.x(), -offsety+pnow.y() + 64 + 36));
QPropertyAnimation *animnext = new QPropertyAnimation(m_SecondWidget, "pos");
animnext->setDuration(m_Speed);
animnext->setEasingCurve(QEasingCurve::OutBack);
animnext->setStartValue(QPoint(pnext.x(), offsety+pnext.y()));
animnext->setEndValue(QPoint(pnext.x(), pnext.y() + 64+ 36));
m_AnimGroup = new QParallelAnimationGroup;
m_AnimGroup->addAnimation(animnow);
m_AnimGroup->addAnimation(animnext);
connect(m_AnimGroup, SIGNAL(finished()),this,SLOT(slideUsbDone()));
m_Active=true;
m_AnimGroup->start();
}
示例14: adjustDrawSize
void DeckHandler::adjustDrawSize()
{
if(drawAnimating)
{
QTimer::singleShot(ANIMATION_TIME+50, this, SLOT(adjustDrawSize()));
return;
}
int rowHeight = ui->drawListWidget->sizeHintForRow(0);
int rows = drawCardList.count();
int height = rows*rowHeight + 2*ui->drawListWidget->frameWidth();
int maxHeight = (ui->drawListWidget->height()+ui->enemyHandListWidget->height())*4/5;
if(height>maxHeight) height = maxHeight;
QPropertyAnimation *animation = new QPropertyAnimation(ui->drawListWidget, "minimumHeight");
animation->setDuration(ANIMATION_TIME);
animation->setStartValue(ui->drawListWidget->minimumHeight());
animation->setEndValue(height);
animation->setEasingCurve(QEasingCurve::OutBounce);
animation->start();
QPropertyAnimation *animation2 = new QPropertyAnimation(ui->drawListWidget, "maximumHeight");
animation2->setDuration(ANIMATION_TIME);
animation2->setStartValue(ui->drawListWidget->maximumHeight());
animation2->setEndValue(height);
animation2->setEasingCurve(QEasingCurve::OutBounce);
animation2->start();
this->drawAnimating = true;
connect(animation, SIGNAL(finished()),
this, SLOT(clearDrawAnimating()));
}
示例15: closeAnimation
void AbstractClipItem::closeAnimation()
{
#if QT_VERSION >= 0x040600
if (!isEnabled()) return;
setEnabled(false);
setFlag(QGraphicsItem::ItemIsSelectable, false);
if (!(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects)) {
// animation disabled
deleteLater();
return;
}
QPropertyAnimation *closeAnimation = new QPropertyAnimation(this, "rect");
QPropertyAnimation *closeAnimation2 = new QPropertyAnimation(this, "opacity");
closeAnimation->setDuration(200);
closeAnimation2->setDuration(200);
QRectF r = rect();
QRectF r2 = r;
r2.setLeft(r.left() + r.width() / 2);
r2.setTop(r.top() + r.height() / 2);
r2.setWidth(1);
r2.setHeight(1);
closeAnimation->setStartValue(r);
closeAnimation->setEndValue(r2);
closeAnimation->setEasingCurve(QEasingCurve::InQuad);
closeAnimation2->setStartValue(1.0);
closeAnimation2->setEndValue(0.0);
QParallelAnimationGroup *group = new QParallelAnimationGroup;
connect(group, SIGNAL(finished()), this, SLOT(deleteLater()));
group->addAnimation(closeAnimation);
group->addAnimation(closeAnimation2);
group->start(QAbstractAnimation::DeleteWhenStopped);
#endif
}