Exemple #1
0
void MayaModule::_showBarraBusqueda(BarraBusqueda *b)
{
    if(!_b_reducida)
        return;
    b->setGeometry(0,40,0,this->height()-60);
    b->show();
    QPropertyAnimation* animation0 = new QPropertyAnimation(b, "size",this);
    connect(animation0,SIGNAL(finished()),animation0,SLOT(deleteLater()));
    animation0->setDuration(1000);
    animation0->setEasingCurve(QEasingCurve::OutElastic);

    animation0->setStartValue(QSize(0,b->height()));
    animation0->setEndValue(QSize(250,b->height()));

    QPropertyAnimation* animation = new QPropertyAnimation(b, "pos",this);
    animation->setDuration(1000);
    animation->setEasingCurve(QEasingCurve::OutElastic);
    animation->setStartValue(QPoint(this->width(),b->pos().y()));
    animation->setEndValue(QPoint(this->width()-250,b->pos().y()));

    QParallelAnimationGroup *group = new QParallelAnimationGroup(this);
    group->addAnimation(animation);
    group->addAnimation(animation0);

    connect(group,SIGNAL(finished()),group,SLOT(deleteLater()));
    group->start();
     _b_reducida = false;
     b->setShow(true);

}
void AbstractClipItem::closeAnimation()
{
    if (!isEnabled()) return;
    setEnabled(false);
    setFlag(QGraphicsItem::ItemIsSelectable, false);
    if (QApplication::style()->styleHint(QStyle::SH_Widget_Animate, 0, QApplication::activeWindow())) {
        // 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);
}
Exemple #3
0
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()));
    }
}
Exemple #4
0
        void EtherMenu::InitializeAnimations()
        {
            for(int i=0; i<objects_.size();i++)
            {
                QParallelAnimationGroup* animgroup = new QParallelAnimationGroup();
                QPropertyAnimation* anim1 = new QPropertyAnimation(objects_.at(i), "pos");
                anim1->setDuration(300);
                anim1->setEasingCurve(QEasingCurve::InOutSine);
                QPropertyAnimation* anim2 = new QPropertyAnimation(objects_.at(i), "scale");
                anim2->setDuration(300);
                anim2->setEasingCurve(QEasingCurve::InOutSine);
                QPropertyAnimation* anim3 = new QPropertyAnimation(objects_.at(i), "opacity");
                anim3->setDuration(300);
                anim3->setEasingCurve(QEasingCurve::InQuad);
                QPropertyAnimation* anim4 = new QPropertyAnimation(objects_.at(i), "z");
                anim3->setDuration(300);
                anim3->setEasingCurve(QEasingCurve::Linear);

                animgroup->addAnimation(anim1);
                animgroup->addAnimation(anim2);
                animgroup->addAnimation(anim3);
                animgroup->addAnimation(anim4);
                animations_->addAnimation(animgroup);

                objects_.at(i)->SetMoveAnimationPointer(anim1);
            }
        }
Exemple #5
0
void MayaModule::_hideBarraBusqueda(BarraBusqueda *b)
{
    if(_b_reducida)
        return;
    QPropertyAnimation* animation0 = new QPropertyAnimation(b, "size",this);
    connect(animation0,SIGNAL(finished()),animation0,SLOT(deleteLater()));
    animation0->setDuration(300);
    animation0->setEasingCurve(QEasingCurve::Linear);

    animation0->setStartValue(QSize(250,b->height()));
    animation0->setEndValue(QSize(20,b->height()));

    QPropertyAnimation* animation = new QPropertyAnimation(b, "pos",this);
    animation->setDuration(200);
    animation->setEasingCurve(QEasingCurve::Linear);
    animation->setStartValue(QPoint(this->width()-250,b->pos().y()));
    animation->setEndValue(QPoint(this->width()-20,b->pos().y()));

    QParallelAnimationGroup *group = new QParallelAnimationGroup(this);
    group->addAnimation(animation);
    group->addAnimation(animation0);

    connect(group,SIGNAL(finished()),group,SLOT(deleteLater()));
    group->start();
    _b_reducida = true;
    b->setShow(false);
}
Exemple #6
0
void CardItem::goBack(bool kieru){
    if(home_pos == pos()){
        if(kieru)
            setOpacity(0.0);
        return;
    }

    QPropertyAnimation *goback = new QPropertyAnimation(this, "pos");
    goback->setEndValue(home_pos);   
    goback->setEasingCurve(QEasingCurve::OutBounce);

    if(kieru){
        QParallelAnimationGroup *group = new QParallelAnimationGroup;

        QPropertyAnimation *disappear = new QPropertyAnimation(this, "opacity");
        disappear->setKeyValueAt(0.9, 1.0);
        disappear->setEndValue(0.0);

        goback->setDuration(1000);
        disappear->setDuration(1000);

        group->addAnimation(goback);
        group->addAnimation(disappear);

        group->start(QParallelAnimationGroup::DeleteWhenStopped);
    }else
        goback->start(QPropertyAnimation::DeleteWhenStopped);
}
Exemple #7
0
void MainWidget::animShowLyricWidget() {
    if (isLyricWidgetShowing() || isAnimationStarted()) return;
    this->animStart();
    this->setMaximumHeight(this->height() + ui->lyricWidget->height());
    QParallelAnimationGroup *animgroup = new QParallelAnimationGroup(this);
    QPoint lyric_cur = ui->lyricWidget->pos();
    QRect self_cur = this->geometry();

    QPropertyAnimation *lyric_anim = new QPropertyAnimation(ui->lyricWidget, "pos");
    lyric_anim->setDuration(400);
    lyric_anim->setStartValue(lyric_cur);
    lyric_cur.setY(ui->controlWidget->height());
    lyric_anim->setEndValue(lyric_cur);
    lyric_anim->setEasingCurve(QEasingCurve::OutCubic);
    animgroup->addAnimation(lyric_anim);

    QPropertyAnimation *self_anim = new QPropertyAnimation(this, "geometry");
    self_anim->setDuration(400);
    self_anim->setStartValue(self_cur);
    self_cur.setHeight(ui->controlWidget->height() + ui->lyricWidget->height());
    self_anim->setEndValue(self_cur);
    self_anim->setEasingCurve(QEasingCurve::OutCubic);
    animgroup->addAnimation(self_anim);

    connect(animgroup, &QAnimationGroup::finished, [=] () {
        _isLyricWidgetShowing = true;
        animFinish();
        ui->pauseWidget->setGeometry(0, 0, ui->pauseWidget->geometry().width(), this->geometry().height());
        this->setMinimumHeight(this->height());
        ui->lyricWidget->setShowing(true);
    });

    animgroup->start(QAbstractAnimation::DeleteWhenStopped);
}
Exemple #8
0
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
}
Exemple #9
0
void mainwidget::animHideChannelWidget(bool immediately) {
    if (!_isChannelWidgetShowing && !immediately) return;

    QParallelAnimationGroup *animgroup = new QParallelAnimationGroup(this);
    QPropertyAnimation *control_anim = new QPropertyAnimation(ui->controlWidget, "pos");
    control_anim->setDuration(400);
    control_anim->setStartValue(ui->controlWidget->pos());
    QPoint endpos = ui->controlWidget->pos();
    endpos.setY(0);
    control_anim->setEndValue(endpos);
    control_anim->setEasingCurve(QEasingCurve::OutCubic);

    animgroup->addAnimation(control_anim);

    QPropertyAnimation *main_anim = new QPropertyAnimation(this, "geometry");
    main_anim->setDuration(400);
    main_anim->setStartValue(this->geometry());
    QRect endval2 = this->geometry();
    endval2.setHeight(ui->controlWidget->geometry().height());
    main_anim->setEndValue(endval2);
    main_anim->setEasingCurve(QEasingCurve::OutCubic);

    animgroup->addAnimation(main_anim);

    connect(animgroup, &QParallelAnimationGroup::finished, [this] () {
        _isChannelWidgetShowing = false;
        QRect pauseGeo = ui->pauseWidget->geometry();
        pauseGeo.setHeight(this->geometry().height());
        ui->pauseWidget->setGeometry(pauseGeo);
        this->setMaximumHeight(pauseGeo.height());
    });
    animgroup->start(QAbstractAnimation::DeleteWhenStopped);
}
Exemple #10
0
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);
}
Exemple #11
0
void mainwidget::animShowChannelWidget() {
    if (_isChannelWidgetShowing) return;

    this->setMaximumHeight(this->controlPanel()->geometry().height()
                           + ui->channelWidget->geometry().height());

    QParallelAnimationGroup *animgroup = new QParallelAnimationGroup(this);
    QPropertyAnimation *control_anim = new QPropertyAnimation(ui->controlWidget, "pos");
    control_anim->setDuration(400);
    control_anim->setStartValue(ui->controlWidget->pos());
    QPoint endpos = ui->controlWidget->pos();
    endpos.setY(ui->channelWidget->geometry().height());
    control_anim->setEndValue(endpos);
    control_anim->setEasingCurve(QEasingCurve::OutCubic);

    animgroup->addAnimation(control_anim);

    QPropertyAnimation *main_anim = new QPropertyAnimation(this, "geometry");
    main_anim->setDuration(400);
    main_anim->setStartValue(this->geometry());
    QRect endval2 = this->geometry();
    endval2.setHeight(endval2.height() + ui->channelWidget->geometry().height());
    main_anim->setEndValue(endval2);
    main_anim->setEasingCurve(QEasingCurve::OutCubic);

    animgroup->addAnimation(main_anim);

    connect(animgroup, &QParallelAnimationGroup::finished, [this] () {
        _isChannelWidgetShowing = true;
        ui->pauseWidget->setGeometry(0, 0, ui->pauseWidget->geometry().width(), this->geometry().height());
    });
    animgroup->start(QAbstractAnimation::DeleteWhenStopped);
}
QAbstractAnimation *CardItem::getGoBackAnimation(bool doFade, bool smoothTransition, int duration) {
    m_animationMutex.lock();
    if (m_currentAnimation != NULL) {
        m_currentAnimation->stop();
        delete m_currentAnimation;
        m_currentAnimation = NULL;
    }
    QPropertyAnimation *goback = new QPropertyAnimation(this, "pos");
    goback->setEndValue(home_pos);
    goback->setEasingCurve(QEasingCurve::OutQuad);
    goback->setDuration(duration);

    if (doFade) {
        QParallelAnimationGroup *group = new QParallelAnimationGroup;
        QPropertyAnimation *disappear = new QPropertyAnimation(this, "opacity");        
        double middleOpacity = qMax(opacity(), m_opacityAtHome);
        if (middleOpacity == 0) middleOpacity = 1.0;        
        disappear->setEndValue(m_opacityAtHome);
        if (!smoothTransition) {
            disappear->setKeyValueAt(0.2, middleOpacity);
            disappear->setKeyValueAt(0.8, middleOpacity);
            disappear->setDuration(duration);
        }

        group->addAnimation(goback);
        group->addAnimation(disappear);

        m_currentAnimation = group;
    } else {
        m_currentAnimation = goback;
    }
    m_animationMutex.unlock();
    connect(m_currentAnimation, SIGNAL(finished()), this, SIGNAL(movement_animation_finished()));
    return m_currentAnimation;
}
Exemple #13
0
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");
    });
}
int LinearLayoutActor::animateMoveToPos(qreal endMainProportion, qreal endCrossProportion, int duration, int initialDelay)
{
	QParallelAnimationGroup* groupAnimation = new QParallelAnimationGroup(this);
	groupAnimation->addAnimation( createMoveToAnimation("mainStart", endMainProportion, mainStart, duration, initialDelay) );
	groupAnimation->addAnimation( createMoveToAnimation("crossStart", endCrossProportion, crossStart, duration, initialDelay) );

	groupAnimation->start();
	return VisualizationSpeed::getInstance().adjust(duration);
}
Exemple #15
0
void MainWidget::animHideChannelWidget() {
    if (!isChannelWidgetShowing() || isAnimationStarted()) return;
    this->animStart();
    QParallelAnimationGroup *animgroup = new QParallelAnimationGroup(this);
    if (this->height() == ui->channelWidget->height() + ui->controlWidget->height()) {
        this->setMinimumHeight(ui->controlWidget->height());

        QPropertyAnimation *main_anim = new QPropertyAnimation(this, "geometry");
        main_anim->setDuration(400);
        main_anim->setStartValue(this->geometry());
        QRect endval2 = this->geometry();
        endval2.setHeight(endval2.height() - ui->channelWidget->height());
        main_anim->setEndValue(endval2);
        main_anim->setEasingCurve(QEasingCurve::OutCubic);

        animgroup->addAnimation(main_anim);
    }

    QPropertyAnimation *control_anim = new QPropertyAnimation(ui->controlWidget, "pos");
    control_anim->setDuration(400);
    control_anim->setStartValue(ui->controlWidget->pos());
    QPoint endpos = ui->controlWidget->pos();
    endpos.setY(0);
    control_anim->setEndValue(endpos);
    control_anim->setEasingCurve(QEasingCurve::OutCubic);

    animgroup->addAnimation(control_anim);

    QPropertyAnimation *topborder_anim = new QPropertyAnimation(this->topBorder, "pos");
    topborder_anim->setDuration(400);
    QPoint topborder_pos = topBorder->pos();
    topborder_anim->setStartValue(topborder_pos);
    topborder_pos.setY(-topBorder->height());
    topborder_anim->setEndValue(topborder_pos);
    topborder_anim->setEasingCurve(QEasingCurve::OutCubic);
    animgroup->addAnimation(topborder_anim);

    QPropertyAnimation *bottomborder_anim = new QPropertyAnimation(this->bottomBorder, "pos");
    bottomborder_anim->setDuration(400);
    QPoint bottomborder_pos = bottomBorder->pos();
    bottomborder_anim->setStartValue(bottomborder_pos);
    bottomborder_pos.setY(ui->controlWidget->height());
    bottomborder_anim->setEndValue(bottomborder_pos);
    bottomborder_anim->setEasingCurve(QEasingCurve::OutCubic);
    animgroup->addAnimation(bottomborder_anim);

    connect(animgroup, &QParallelAnimationGroup::finished, [this] () {
        _isChannelWidgetShowing = false;
        this->animFinish();
        QRect pauseGeo = ui->pauseWidget->geometry();
        pauseGeo.setHeight(this->geometry().height());
        ui->pauseWidget->setGeometry(pauseGeo);
        this->setMaximumHeight(this->height());
    });
    animgroup->start(QAbstractAnimation::DeleteWhenStopped);
}
int LinearLayoutActor::animatePaddingIncrease(qreal topIncrease, qreal rightIncrease, qreal bottomIncrease, qreal leftIncrease, int duration, int initialDelay)
{
	QParallelAnimationGroup* groupAnimation = new QParallelAnimationGroup(this);
	groupAnimation->addAnimation( createPaddingAnimation("paddingTop", topIncrease, getPaddingTop(), duration, initialDelay) );
	groupAnimation->addAnimation( createPaddingAnimation("paddingRight", rightIncrease, getPaddingRight(), duration, initialDelay) );
	groupAnimation->addAnimation( createPaddingAnimation("paddingBottom", bottomIncrease, getPaddingBottom(), duration, initialDelay) );
	groupAnimation->addAnimation( createPaddingAnimation("paddingLeft", leftIncrease, getPaddingLeft(), duration, initialDelay) );

	groupAnimation->start();
	return VisualizationSpeed::getInstance().adjust(duration);
}
Exemple #17
0
QAbstractAnimation* CardItem::goBack(bool kieru,bool fadein,bool fadeout){
    if(home_pos == pos()){
        if(kieru && home_pos != QPointF(-6, 8))
            setOpacity(0.0);
        return NULL;
    }

    QPropertyAnimation *goback = new QPropertyAnimation(this, "pos");
    goback->setEndValue(home_pos);
    goback->setEasingCurve(QEasingCurve::OutQuad);
    goback->setDuration(500);

    if(kieru){
        QParallelAnimationGroup *group = new QParallelAnimationGroup;

        QPropertyAnimation *disappear = new QPropertyAnimation(this, "opacity");
        if(fadein)disappear->setStartValue(0.0);
        disappear->setEndValue(1.0);
        if(fadeout)disappear->setEndValue(0.0);

        disappear->setKeyValueAt(0.2, 1.0);
        disappear->setKeyValueAt(0.8, 1.0);


        qreal dx = home_pos.x()-pos().x();
        qreal dy = home_pos.y()-pos().y();
        int length = sqrt(dx*dx+dy*dy);


        length = qBound(500/3,length,400);

        goback->setDuration(length*3);
        disappear->setDuration(length*3);

        group->addAnimation(goback);
        group->addAnimation(disappear);

        // prevent the cover face bug
        setEnabled(false);

        group->start(QParallelAnimationGroup::DeleteWhenStopped);
        return group;
    }else
    {
        setOpacity(this->isEnabled() ? 1.0 : 0.7);
        goback->start(QPropertyAnimation::DeleteWhenStopped);
        return goback;
    }
}
Exemple #18
0
void Unite::animationDeplacement(vector<Case *> chemin ) {
    this->setSelected(false);
     float decalageX,decalageY;
     Case* caseActu=chemin[0];
     QSequentialAnimationGroup *group = new QSequentialAnimationGroup();
     QSequentialAnimationGroup *animPm = new QSequentialAnimationGroup();
     QParallelAnimationGroup *groupPara = new QParallelAnimationGroup();

     QPointF OS = offset();
     int anim;
     int j=1;

     for (unsigned int i=1;i<chemin.size(); i++) {
         QPropertyAnimation *animation = new QPropertyAnimation(this, "offset");
         animation->setDuration(200);

         decalageX = (chemin[i]->getX()-caseActu->getX())*SIZE;
         decalageY = (chemin[i]->getY()-caseActu->getY())*SIZE;

         if (decalageX>0)
             anim=30;
         else if (decalageX<0)
             anim=20;
         else if (decalageY<0)
             anim=10;
         else if (decalageY>0)
             anim=0;

         QPropertyAnimation *animPix = new QPropertyAnimation(this, "pixmap");
         animPix->setDuration(200);
         animPix->setStartValue(anim);
         animPix->setEndValue(anim+7);
         animPm->addAnimation(animPix);

         animation->setStartValue(OS);
         OS=QPointF(OS.x()+decalageX,OS.y()+decalageY);
         animation->setEndValue(OS);
         group->addAnimation(animation);

         j++;
         caseActu=chemin[i];
     }

     groupPara->addAnimation(group);
     groupPara->addAnimation(animPm);
     groupPara->start();
     this->setSelected(true);
}
Exemple #19
0
void VisualTree::swap_values(VisualTreeElement *e1, VisualTreeElement *e2)
{
    QParallelAnimationGroup * pgr = new QParallelAnimationGroup;

    e1->setColor(Qt::cyan);
    e2->setColor(Qt::cyan);
    QPropertyAnimation *a1= new QPropertyAnimation(e1, "opacity");
    a1->setDuration(1000);
    a1->setStartValue(1);
    a1->setEndValue(0);
    QPropertyAnimation *a2= new QPropertyAnimation(e2, "opacity");
    a2->setDuration(1000);
    a2->setStartValue(1);
    a2->setEndValue(0);

    int tmp;
    tmp = e1->getValue();
    e1->setValue(e2->getValue());
    e2->setValue(tmp);

    pgr->addAnimation(a1);
    pgr->addAnimation(a2);
    pgr->start(QAbstractAnimation::DeleteWhenStopped);

    connect(pgr, SIGNAL(finished()), this, SLOT(animationFinished()));

}
Exemple #20
0
void Window::appear() {
    QPropertyAnimation *scale_x = new QPropertyAnimation(scaleTransform, "xScale");
    QPropertyAnimation *scale_y = new QPropertyAnimation(scaleTransform, "yScale");
    QPropertyAnimation *opacity = new QPropertyAnimation(this, "opacity");
    QParallelAnimationGroup *group = new QParallelAnimationGroup();

    scale_x->setEndValue(1);
    scale_y->setEndValue(1);
    opacity->setEndValue(1.0);
    group->addAnimation(scale_x);
    group->addAnimation(scale_y);
    group->addAnimation(opacity);

    group->start(QAbstractAnimation::DeleteWhenStopped);

}
Exemple #21
0
void HitExplosion::determined(Ts::DetermineValue value)
{
    if (value == Ts::GOOD)
    {
        greatItem_->hide();
        goodItem_->show();
    }
    else if (value == Ts::GREAT)
    {
        goodItem_->hide();
        greatItem_->show();
    }
    else
    {
        return;
    }

    QParallelAnimationGroup *group = new QParallelAnimationGroup;
    QPropertyAnimation *animation = new QPropertyAnimation(this,"opacity");
    animation->setDuration(200);
    animation->setKeyValueAt(0.0,0.0);
    animation->setKeyValueAt(0.1,0.5);
    animation->setKeyValueAt(0.9,0.5);
    animation->setKeyValueAt(1.0,0.0);
    group->addAnimation(animation);

    show();
    group->start(QAbstractAnimation::DeleteWhenStopped);
}
    void startZoomOutAnimation()
    {
        if (zoomedIndex < 0)
            return;

        int lm, tm, rm, bm;
        m_public->getContentsMargins(&lm, &tm, &rm, &bm);
        QRect adjustedGeo = m_public->geometry().adjusted(lm, tm, -rm, -bm);
        int spacing = m_public->spacing();

        QSize cellSize = calculateCellSize(adjustedGeo,spacing);
        QParallelAnimationGroup * animGroup = new QParallelAnimationGroup;
        for (int i = 0; i < list.size(); ++i) {
            Wrapper * wr = list.at(i);
            wr->item->widget()->show();
            QPropertyAnimation * anim = new QPropertyAnimation(wr->item->widget(), "geometry");
            anim->setEndValue(
                        calculateCellGeometry(
                            adjustedGeo, cellSize, spacing,
                            wr->row, wr->col, wr->rowSpan,wr->colSpan));
            anim->setDuration(duration);
            anim->setEasingCurve(easing);
            animGroup->addAnimation(anim);
        }
        qApp->connect(animGroup, SIGNAL(finished()), m_public, SIGNAL(animationFinished()));
        animationRunning = true;
        animGroup->start(QAbstractAnimation::DeleteWhenStopped);
        zoomedIndex = -1;
    }
Exemple #23
0
void CardItem::goBack(bool kieru,bool fadein,bool fadeout){
    if(home_pos == pos()){
        if(kieru)
            setOpacity(0.0);
        return;
    }

    QPropertyAnimation *goback = new QPropertyAnimation(this, "pos");
    goback->setEndValue(home_pos);
    goback->setEasingCurve(QEasingCurve::OutQuad);
    goback->setDuration(300);

    if(kieru){
        QParallelAnimationGroup *group = new QParallelAnimationGroup;

        QPropertyAnimation *disappear = new QPropertyAnimation(this, "opacity");
        if(fadein)disappear->setStartValue(0.0);
        disappear->setEndValue(1.0);
        if(fadeout)disappear->setEndValue(0.0);

        disappear->setKeyValueAt(0.2, 1.0);
        disappear->setKeyValueAt(0.8, 1.0);


        int dx = home_pos.x()-pos().x();
        int dy = home_pos.y()-pos().y();
        int length = sqrt(dx*dx+dy*dy);


        if(length*3>500)disappear->setStartValue(0.0);
        else length = 500/3;

        if(length*3>1200)length =400;

        goback->setDuration(length*3);
        disappear->setDuration(length*3);

        group->addAnimation(goback);
        group->addAnimation(disappear);

        // prevent the cover face bug
        setEnabled(false);

        group->start(QParallelAnimationGroup::DeleteWhenStopped);
    }else
        goback->start(QPropertyAnimation::DeleteWhenStopped);
}
void StartScene::switchToServer(Server *server) {
#ifdef AUDIO_SUPPORT
    Audio::quit();
#endif
    // performs leaving animation
    QPropertyAnimation *logo_shift = new QPropertyAnimation(logo, "pos");
    logo_shift->setEndValue(QPointF(Config.Rect.center().rx() - 200, Config.Rect.center().ry() - 175));

    QPropertyAnimation *logo_shrink = new QPropertyAnimation(logo, "scale");
    logo_shrink->setEndValue(0.5);

    QParallelAnimationGroup *group = new QParallelAnimationGroup(this);
    group->addAnimation(logo_shift);
    group->addAnimation(logo_shrink);
    group->start(QAbstractAnimation::DeleteWhenStopped);

    foreach (Button *button, buttons)
        delete button;
    buttons.clear();

    server_log = new QTextEdit();
    server_log->setReadOnly(true);
    server_log->resize(700, 420);
    server_log->move(-400, -180);
    server_log->setFrameShape(QFrame::NoFrame);
#ifdef Q_OS_LINUX
    server_log->setFont(QFont("DroidSansFallback", 12));
#else
    server_log->setFont(QFont("Verdana", 12));
#endif
    server_log->setTextColor(Config.TextEditColor);
    setServerLogBackground();
    addWidget(server_log);

    QScrollBar *bar = server_log->verticalScrollBar();
    QFile file("qss/scroll.qss");
    if (file.open(QIODevice::ReadOnly)) {
        QTextStream stream(&file);
        bar->setStyleSheet(stream.readAll());
    }

    printServerInfo();
    connect(server, SIGNAL(server_message(QString)), server_log, SLOT(append(QString)));
    update();
}
void StartScene::switchToServer(Server *server){    
#ifdef AUDIO_SUPPORT
    if(SoundEngine) {
#ifdef  Q_OS_WIN32
        SoundEngine->drop();
        SoundEngine = NULL;
#else
        delete SoundEngine;
#endif
    }
#endif

    // performs leaving animation
    QPropertyAnimation *logo_shift = new QPropertyAnimation(logo, "pos");
    logo_shift->setEndValue(Config.Rect.topLeft());

    QPropertyAnimation *logo_shrink = new QPropertyAnimation(logo, "scale");
    logo_shrink->setEndValue(0.5);

    QParallelAnimationGroup *group = new QParallelAnimationGroup(this);
    group->addAnimation(logo_shift);
    group->addAnimation(logo_shrink);
    group->start(QAbstractAnimation::DeleteWhenStopped);

    foreach(Button *button, buttons)
        delete button;
    buttons.clear();

    server_log = new QTextEdit();
    server_log->setReadOnly(true);
    server_log->resize(700, 420);
    server_log->move(-400, -180);
    server_log->setFrameShape(QFrame::NoFrame);
    server_log->setFont(QFont("Verdana", 12));
    server_log->setTextColor(Config.TextEditColor);
    setServerLogBackground();

    addWidget(server_log);

    printServerInfo();

    connect(server, SIGNAL(server_message(QString)), server_log, SLOT(append(QString)));

    update();
}
void TablePile::_fadeOutCardsLocked(const QList<CardItem *> &cards) {
    QParallelAnimationGroup *group = new QParallelAnimationGroup;
    foreach (CardItem *toRemove, cards) {
        toRemove->setZValue(0.0);
        toRemove->setHomeOpacity(0.0);
        toRemove->setHomePos(QPointF(toRemove->homePos().x(), toRemove->homePos().y()));
        toRemove->deleteLater();
        group->addAnimation(toRemove->getGoBackAnimation(true, false, 1000));
    }
Exemple #27
0
void Window::disappear() {
    QPropertyAnimation *scale_x = new QPropertyAnimation(scaleTransform, "xScale");
    QPropertyAnimation *scale_y = new QPropertyAnimation(scaleTransform, "yScale");
    QPropertyAnimation *opacity = new QPropertyAnimation(this, "opacity");
    QParallelAnimationGroup *group = new QParallelAnimationGroup();

    scale_x->setEndValue(1.05);
    scale_y->setEndValue(0.95);
    opacity->setEndValue(0.0);
    group->addAnimation(scale_x);
    group->addAnimation(scale_y);
    group->addAnimation(opacity);

    group->start(QAbstractAnimation::DeleteWhenStopped);

    if (!keep_when_disappear)
        connect(group, SIGNAL(finished()), this, SLOT(deleteLater()));
}
void AVLTree::RR(TreeNode * &k2, QAnimationGroup *group)
{
    qDebug() << "RR";
    TreeNode *k1;
    k1 = k2->Rson;
    k2->Rson = k1->Lson;
    k1->Lson = k2;
    k1->h = max(height(k1->Lson), height(k1->Rson)) + 1;
    k2->h = max(height(k2->Lson), height(k2->Rson)) + 1;
    k2 = k1;
    if (group)
    {
        QParallelAnimationGroup *anim = new QParallelAnimationGroup;
        anim->addAnimation(k1->setParent(k1->Lson->parent));
        anim->addAnimation(k1->Lson->setParent(k1));
        if (k1->Lson->Rson) anim->addAnimation(k1->Lson->Rson->setParent(k1->Lson));
        group->addAnimation(anim);
        group->addAnimation(getPosAnim());
    }
}
Exemple #29
0
void Item::moveAndResize ( const QPointF& pos, qreal tileSize, const QSize& size, bool animated )
{
    if ( !animated || Settings::animationSpeed() == Settings::EnumAnimationSpeed::Instant )
    {
        setPos ( pos );
        setRenderSize ( size );
    }
    else
    {
        int duration = 0;
        switch ( Settings::animationSpeed() )
        {
            case Settings::EnumAnimationSpeed::Fast:
                duration = fastAnimationDuration;
                break;
            case Settings::EnumAnimationSpeed::Normal:
                duration = normalAnimationDuration;
                break;
            case Settings::EnumAnimationSpeed::Slow:
                duration = slowAnimationDuration;
                break;
            default:
                break;
        }
        duration *= qSqrt ( QPointF ( this->pos() - pos ).manhattanLength() / tileSize );
        QParallelAnimationGroup* group = new QParallelAnimationGroup;
        QPropertyAnimation* posAnimation = new QPropertyAnimation ( this, "pos" );
        posAnimation->setDuration ( duration );
        posAnimation->setEasingCurve ( QEasingCurve::InOutCubic );
        posAnimation->setEndValue ( pos );
        group->addAnimation ( posAnimation );
        QPropertyAnimation* sizeAnimation = new QPropertyAnimation ( this, "renderSize" );
        sizeAnimation->setDuration ( duration );
        sizeAnimation->setEasingCurve ( QEasingCurve::InOutCubic );
        sizeAnimation->setEndValue ( size );
        group->addAnimation ( sizeAnimation );
        group->start ( QAbstractAnimation::DeleteWhenStopped );
    }
}
Exemple #30
0
void SlideBar::slide(bool visible)
{
    // Show the widget with the previous opacity. It must be hidden after the slide(false) because if opacity == 0, the
    // widget is still clickable.
    this->forceShow();
    this->setWindowOpacity(m_isShown ? m_opacity : 0);

    // Set animation to slide the widget and update the opacity
    QParallelAnimationGroup* animations = new QParallelAnimationGroup();

    // slide animation
    QPropertyAnimation* geomAnimation = new QPropertyAnimation(this, "geometry");
    geomAnimation->setDuration(500);
    geomAnimation->setEasingCurve(QEasingCurve::InBack);
    geomAnimation->setStartValue(this->geometry());

    if(visible == true)
    {
        geomAnimation->setEndValue(m_shownPosition);
    }
    else
    {
        geomAnimation->setEndValue(m_hiddenPosition);

        // hide the widget when the animation is finished (if opacity == 0, widget is still clickable)
        QObject::connect(animations, &QAbstractAnimation::finished, this, &SlideBar::forceHide);
    }

    // opacity animation
    QPropertyAnimation* opacityAnimation = new QPropertyAnimation(this, "windowOpacity");
    opacityAnimation->setDuration(500);
    opacityAnimation->setEndValue(visible ? m_opacity : 0);

    animations->addAnimation(geomAnimation);
    animations->addAnimation(opacityAnimation);

    animations->start(QPropertyAnimation::DeleteWhenStopped);
    m_isShown = visible;
}