#include <QtCore>
#include <QApplication>
#include <QtGui>
int main(int argc, char *argv[])
{
button1->show();
button2->setGeometry(50, 50, 100, 30);
button2->show();
QPropertyAnimation animation(button1, "geometry");
animation.setDuration(5000);
animation.
setKeyValueAt(0,
QRect(0,
0,
100,
30));
animation.
setKeyValueAt(0.1,
QRect(150,
150,
100,
30));
animation.
setKeyValueAt(1,
QRect(0,
0,
100,
30));
animation.setEasingCurve(QEasingCurve::OutBounce);
animation.start();
return a.exec();
}
#include <QtCore>
#include <QApplication>
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QPushButton *button1=new QPushButton("Animated");
button1->show();
QPushButton *button2 = new QPushButton("Not animated");
button2->setGeometry(50, 50, 100, 30);
button2->show();
QPropertyAnimation animation(button1, "geometry");
animation.setDuration(5000);
animation.setKeyValueAt(0, QRect(0, 0, 100, 30));
animation.setKeyValueAt(0.1, QRect(150, 150, 100, 30));
animation.setKeyValueAt(1, QRect(0, 0, 100, 30));
animation.setEasingCurve(QEasingCurve::OutBounce);
animation.start();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks