btn = new QPushButton(this);
btn->resize(100, 100);
btn->move(0, 0);
btn->setStyleSheet("border-image:url(D:/gui/Exercise/image/roe.png)");
animation = new QPropertyAnimation(btn, "geometry");
animation->setDuration(200);
animation->setStartValue(QRect(0, 0, 100, 100));
animation->setEndValue(QRect(500, 500, 50, 50));
animation->setEasingCurve(QEasingCurve::OutBounce);
animation->start();
开始位置:
移动后:
界面渐变出现
仅需将以下代码放到构造函数中便可:
animation = new QPropertyAnimation(this, "windowOpacity");
animation->setDuration(2000);
animation->setStartValue(0);
animation->setEndValue(1);
animation->start();