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"); }); }
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); }
void AVLTree::Find(int x, bool showProgress) { if (showProgress) { QSequentialAnimationGroup *group = new QSequentialAnimationGroup; Find(root, x, group); group->start(QAbstractAnimation::DeleteWhenStopped); } else { Find(root, x, NULL); } }
void AVLTree::Delete(int x, bool showProgress) { if (showProgress) { QSequentialAnimationGroup *group = new QSequentialAnimationGroup; Delete(root, x, group); group->start(QAbstractAnimation::DeleteWhenStopped); } else { Delete(root, x, NULL); getPosAnim()->start(QAbstractAnimation::DeleteWhenStopped); getEdgeAnim()->start(QAbstractAnimation::DeleteWhenStopped); } }
void AVLTree::LevelOrder() { QSequentialAnimationGroup *group = new QSequentialAnimationGroup; QQueue<TreeNode*> q; q.push_back(root); while (!q.empty()) { TreeNode *node = q.front(); q.pop_front(); if (node == NULL) continue; group->addAnimation(node->getPopAnim()); q.push_back(node->Lson); q.push_back(node->Rson); } group->start(QAbstractAnimation::DeleteWhenStopped); }
void IndicatorItem::doAnimation() { QSequentialAnimationGroup *group = new QSequentialAnimationGroup(this); QPropertyAnimation *animation = new QPropertyAnimation(this, "finish"); animation->setEndValue(real_finish); animation->setEasingCurve(QEasingCurve::OutCubic); animation->setDuration(500); QPropertyAnimation *pause = new QPropertyAnimation(this, "opacity"); pause->setEndValue(0); pause->setEasingCurve(QEasingCurve::InQuart); pause->setDuration(600); group->addAnimation(animation); group->addAnimation(pause); group->start(QAbstractAnimation::DeleteWhenStopped); connect(group, &QSequentialAnimationGroup::finished, this, &IndicatorItem::deleteLater); }
void TFutureProgressPrivate::_q_FadeAway() { Q_Q(TFutureProgress); FaderWidget->raise(); QSequentialAnimationGroup *Group = new QSequentialAnimationGroup(q); QPropertyAnimation *Animation = new QPropertyAnimation(FaderWidget, "Opacity"); Animation->setDuration(600); Animation->setEndValue(1.0); Group->addAnimation(Animation); Animation = new QPropertyAnimation(q, "maximumHeight"); Animation->setDuration(120); Animation->setEasingCurve(QEasingCurve::InCurve); Animation->setStartValue(q->sizeHint().height()); Animation->setEndValue(0.0); Group->addAnimation(Animation); Group->start(QAbstractAnimation::DeleteWhenStopped); QObject::connect(Group, SIGNAL(finished()), q, SIGNAL(RemoveMe())); }
void Creator::TestToLogIn() { singleWindow->show(); QParallelAnimationGroup* parallelWindow = WindowToMenuAnimation(TestWindow , singleWindow , TestState , SingleState ); QParallelAnimationGroup* parallel = new QParallelAnimationGroup; parallel->addAnimation(parallelWindow); QSequentialAnimationGroup* sequential = new QSequentialAnimationGroup; sequential->addAnimation(parallel); sequential->start(); sleep(1000); for ( int i = 0 ; i < 10 ; i++ ){ testwidget->but[i]->setProperty("pos",QPointF(testwidget->but[9]->x(),testwidget->but[9]->y())); } TestWindow->close(); }
void Creator::LogInToTest(QString user_name) { testwidget->SetUserName(user_name); testwidget->upDateScores(); TestWindow->show(); QParallelAnimationGroup* parallelWindow = WindowAnimation(LogInWindow , TestWindow , LogState , TestState); QParallelAnimationGroup* parallelButton = ButtonAnimation(testwidget->but, 10); QParallelAnimationGroup* parallel = new QParallelAnimationGroup; parallel->addAnimation(parallelWindow); QSequentialAnimationGroup* sequential = new QSequentialAnimationGroup; sequential->addAnimation(parallel); sequential->addPause(0); sequential->addAnimation(parallelButton); sequential->start(); sleep(1000); LogInWindow->close(); }
void FutureProgressPrivate::fadeAway() { m_isFading = true; QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect; opacityEffect->setOpacity(1.); m_q->setGraphicsEffect(opacityEffect); QSequentialAnimationGroup *group = new QSequentialAnimationGroup(this); QPropertyAnimation *animation = new QPropertyAnimation(opacityEffect, "opacity"); animation->setDuration(StyleHelper::progressFadeAnimationDuration); animation->setEndValue(0.); group->addAnimation(animation); animation = new QPropertyAnimation(m_q, "maximumHeight"); animation->setDuration(120); animation->setEasingCurve(QEasingCurve::InCurve); animation->setStartValue(m_q->sizeHint().height()); animation->setEndValue(0.0); group->addAnimation(animation); connect(group, &QAbstractAnimation::finished, m_q, &FutureProgress::removeMe); group->start(QAbstractAnimation::DeleteWhenStopped); emit m_q->fadeStarted(); }
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(); } }
void Barbel::Scene::initScene() { //Setup Framegraph if (m_frameGraph == Q_NULLPTR) m_frameGraph = new Qt3D::QFrameGraph(); if (m_forwardRenderer == Q_NULLPTR) m_forwardRenderer = new Qt3D::QForwardRenderer(); m_forwardRenderer->setClearColor(Qt::black); m_frameGraph->setActiveFrameGraph(m_forwardRenderer); m_rootEntity->addComponent(m_frameGraph); //Test Objects Barbel::Player *player = new Barbel::Player(m_rootEntity); player->setTranslation(QVector3D(0.0f, 0.0f, 0.0f)); setActiveCamera(player->camera()); activeCamera()->lens()->setAspectRatio(m_cameraAspectRatio); QVector3D startPostion(0.0f, 0.0f, 0.0f); QVector3D secondPosition(10.0f, 10.0f, 10.0f); QVector3D thirdPosition(-10.0f, 0.0f, 10.0f); QVector3D startAngles(0.0f, 0.0f, 0.0f); QVector3D secondAngles(45.0f, 150.0f, 0.0f); QVector3D thirdAngles(0.0f, 200.0f, 0.0f); QVector3D finalAngles(0.0f, 360.0f, 0.0f); QSequentialAnimationGroup *animationGroup = new QSequentialAnimationGroup(this); QParallelAnimationGroup *parallelAnimationGroup1 = new QParallelAnimationGroup(this); QPropertyAnimation *animation = new QPropertyAnimation(player, "translation", this); animation->setDuration(5000); animation->setStartValue(startPostion); animation->setEndValue(secondPosition); parallelAnimationGroup1->addAnimation(animation); QPropertyAnimation *rotationAnimation = new QPropertyAnimation(player, "rotation", this); rotationAnimation->setDuration(5000); rotationAnimation->setStartValue(startAngles); rotationAnimation->setEndValue(secondAngles); parallelAnimationGroup1->addAnimation(rotationAnimation); animationGroup->addAnimation(parallelAnimationGroup1); QParallelAnimationGroup *parallelAnimationGroup2 = new QParallelAnimationGroup(this); animation = new QPropertyAnimation(player, "translation", this); animation->setDuration(5000); animation->setStartValue(secondPosition); animation->setEndValue(thirdPosition); parallelAnimationGroup2->addAnimation(animation); rotationAnimation = new QPropertyAnimation(player, "rotation", this); rotationAnimation->setDuration(5000); rotationAnimation->setStartValue(secondAngles); rotationAnimation->setEndValue(thirdAngles); parallelAnimationGroup2->addAnimation(rotationAnimation); animationGroup->addAnimation(parallelAnimationGroup2); QParallelAnimationGroup *parallelAnimationGroup3 = new QParallelAnimationGroup(this); animation = new QPropertyAnimation(player, "translation", this); animation->setDuration(5000); animation->setStartValue(thirdPosition); animation->setEndValue(startPostion); parallelAnimationGroup3->addAnimation(animation); rotationAnimation = new QPropertyAnimation(player, "rotation", this); rotationAnimation->setDuration(5000); rotationAnimation->setStartValue(thirdAngles); rotationAnimation->setEndValue(finalAngles); parallelAnimationGroup3->addAnimation(rotationAnimation); animationGroup->addAnimation(parallelAnimationGroup3); animationGroup->setLoopCount(-1); animationGroup->start(); //Test Cubes Qt3D::QPhongMaterial *phongMaterial1 = new Qt3D::QPhongMaterial(); phongMaterial1->setDiffuse(QColor(94, 141, 25)); phongMaterial1->setSpecular(Qt::white); Qt3D::QPhongMaterial *phongMaterial2 = new Qt3D::QPhongMaterial(); phongMaterial2->setDiffuse(QColor(129, 23, 71)); phongMaterial2->setSpecular(Qt::white); for (int z = -5; z < 5; z++) { for (int y = -5; y < 5; y++) { for (int x = -5; x < 5; x++) { float xSize = (rand() % 10000) / 10000.0; float ySize = (rand() % 10000) / 10000.0; float zSize = (rand() % 10000) / 10000.0; Barbel::TestCube *cube = new TestCube(QVector3D(x, y, z), QVector3D(xSize, ySize, zSize), m_rootEntity); if (y % 2) cube->addComponent(phongMaterial1); else cube->addComponent(phongMaterial2); } } } }
void AVLTree::PostOrder() { QSequentialAnimationGroup *group = new QSequentialAnimationGroup; PostOrder(root, group); group->start(QAbstractAnimation::DeleteWhenStopped); }
void GlanceShower::Start () { if (!TabWidget_) { qWarning () << Q_FUNC_INFO << "no tab widget set"; return; } int count = TabWidget_->count (); if (count < 2) return; QSequentialAnimationGroup *animGroup = new QSequentialAnimationGroup; int sqr = std::sqrt ((double)count); int rows = sqr; int cols = sqr; if (rows * cols < count) ++cols; if (rows * cols < count) ++rows; QRect screenGeom = QApplication::desktop ()-> screenGeometry (Core::Instance ().GetReallyMainWindow ()); int width = screenGeom.width (); int height = screenGeom.height (); int singleW = width / cols; int singleH = height / rows; int wW = singleW * 4 / 5; int wH = singleH * 4 / 5; qreal scaleFactor = 0; QSize sSize; int animLength = 500 / (sqr); QProgressDialog pg; pg.setMinimumDuration (1000); pg.setRange (0, count); for (int row = 0; row < rows; ++row) for (int column = 0; column < cols && column + row * cols < count; ++column) { int idx = column + row * cols; pg.setValue (idx); QWidget *w = TabWidget_->widget (idx); if (!sSize.isValid ()) sSize = w->size () / 2; if (sSize != w->size ()) w->resize (sSize * 2); if (!scaleFactor) scaleFactor = std::min (static_cast<qreal> (wW) / sSize.width (), static_cast<qreal> (wH) / sSize.height ()); QPixmap pixmap (sSize * 2); w->render (&pixmap); pixmap = pixmap.scaled (sSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); { QPainter p (&pixmap); QPen pen (Qt::black); pen.setWidth (2 / scaleFactor + 1); p.setPen (pen); p.drawRect (QRect (QPoint (0, 0), sSize)); } GlanceItem *item = new GlanceItem (pixmap); item->SetIndex (idx); connect (item, SIGNAL (clicked (int)), this, SLOT (handleClicked (int))); Scene_->addItem (item); item->setTransformOriginPoint (sSize.width () / 2, sSize.height () / 2); item->setScale (scaleFactor); item->SetIdealScale (scaleFactor); item->setOpacity (0); item->moveBy (column * singleW, row * singleH); QParallelAnimationGroup *pair = new QParallelAnimationGroup; QPropertyAnimation *posAnim = new QPropertyAnimation (item, "Pos"); posAnim->setDuration (animLength); posAnim->setStartValue (QPointF (0, 0)); posAnim->setEndValue (QPointF (column * singleW, row * singleH)); posAnim->setEasingCurve (QEasingCurve::OutSine); pair->addAnimation (posAnim); QPropertyAnimation *opacityAnim = new QPropertyAnimation (item, "Opacity"); opacityAnim->setDuration (animLength); opacityAnim->setStartValue (0.); opacityAnim->setEndValue (1.); pair->addAnimation (opacityAnim); animGroup->addAnimation (pair); } setScene (Scene_); setGeometry (screenGeom); animGroup->start (); show (); }