Qt之简单的动态效果

移动

 

QRect rect = QApplication::desktop()->availableGeometry();
      
        qDebug() << m_vTile.at(0)->x();

        for (int i = 0; i < m_vTile.size(); i++)
        {
            QPropertyAnimation * animation1 = new QPropertyAnimation(m_vTile[i], "pos");
            animation1->setDuration(300);
            animation1->setStartValue(QPoint(m_vTile.at(i)->x(), m_vTile.at(i)->y()));
            //animation1->setEndValue(QPoint(m_vTile.at(i)->x(), m_vTile.at(i)->y()));
            animation1->setEndValue(QPoint(rect.width() / 2, rect.height()));
            animation1->setEasingCurve(QEasingCurve::OutCubic);
            animation1->start(QAbstractAnimation::DeleteWhenStopped);

        }

 

 

隐藏

     QPropertyAnimation *pAnimation = new QPropertyAnimation(this, "windowOpacity");
     pAnimation->setDuration(500);
     pAnimation->setKeyValueAt(0, 0.99);
     pAnimation->setKeyValueAt(1, 0);
     pAnimation->start(QAbstractAnimation::DeleteWhenStopped);

你可能感兴趣的:(Qt)