| 93 | } |
| 94 | |
| 95 | void SlidePage::slideIn(){ |
| 96 | if(curAni){ |
| 97 | curAni->stop(); |
| 98 | curAni->deleteLater(); |
| 99 | curAni = nullptr; |
| 100 | } |
| 101 | onShown = true; |
| 102 | sheildLayer->raise(); |
| 103 | sheildLayer->setEnabled(true); |
| 104 | this->raise(); |
| 105 | sheildLayer->show(); |
| 106 | QParallelAnimationGroup *inGroup = new QParallelAnimationGroup(this); |
| 107 | QPropertyAnimation *slideInAni = new QPropertyAnimation(this, "pos", this); |
| 108 | slideInAni->setStartValue(this->pos()); |
| 109 | slideInAni->setEndValue(QPoint(0, 0)); |
| 110 | slideInAni->setDuration(1000); |
| 111 | slideInAni->setEasingCurve(QEasingCurve::InOutExpo); |
| 112 | QPropertyAnimation *fadeInAni = new QPropertyAnimation(opacity, "opacity", this); |
| 113 | fadeInAni->setStartValue(opacity->opacity()); |
| 114 | //> note: DO NOT CHANGE 0.99 TO 1!!!!! |
| 115 | //> Will cause unexpected position shift (maybe qt's bug) |
| 116 | fadeInAni->setEndValue(0.99); |
| 117 | fadeInAni->setDuration(750); |
| 118 | QSequentialAnimationGroup *rotate = new QSequentialAnimationGroup(this); |
| 119 | QPropertyAnimation *rotateAni = new QPropertyAnimation(backIcon, "rotationAngle", this); |
| 120 | rotateAni->setStartValue(180); |
| 121 | rotateAni->setEndValue(360); |
| 122 | rotateAni->setDuration(750); |
| 123 | rotateAni->setEasingCurve(QEasingCurve::InOutExpo); |
| 124 | rotate->addPause(250); |
| 125 | rotate->addAnimation(rotateAni); |
| 126 | inGroup->addAnimation(slideInAni); |
| 127 | inGroup->addAnimation(fadeInAni); |
| 128 | inGroup->addAnimation(rotate); |
| 129 | connect(inGroup, &QParallelAnimationGroup::finished, this, [=](){this->curAni = nullptr;}); |
| 130 | inGroup->start(); |
| 131 | curAni = inGroup; |
| 132 | } |
| 133 | |
| 134 | void SlidePage::slideOut(){ |
| 135 | if(curAni){ |
no test coverage detected