mirror of https://github.com/procxx/kepka.git
Clip intro animation by Next button.
This commit is contained in:
parent
66961dce83
commit
524d64a462
|
@ -233,6 +233,9 @@ bool Step::paintAnimated(Painter &p, QRect clip) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!_coverAnimation.clipping.isEmpty()) {
|
||||||
|
p.setClipRect(_coverAnimation.clipping);
|
||||||
|
}
|
||||||
|
|
||||||
auto progress = (hasCover() ? anim::easeOutCirc(1., dt) : anim::linear(1., dt));
|
auto progress = (hasCover() ? anim::easeOutCirc(1., dt) : anim::linear(1., dt));
|
||||||
auto arrivingAlpha = progress;
|
auto arrivingAlpha = progress;
|
||||||
|
@ -451,6 +454,10 @@ void Step::showAnimated(Direction direction) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Step::setShowAnimationClipping(QRect clipping) {
|
||||||
|
_coverAnimation.clipping = clipping;
|
||||||
|
}
|
||||||
|
|
||||||
void Step::setGoCallback(Fn<void(Step *step, Direction direction)> callback) {
|
void Step::setGoCallback(Fn<void(Step *step, Direction direction)> callback) {
|
||||||
_goCallback = std::move(callback);
|
_goCallback = std::move(callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ public:
|
||||||
void showAnimated(Direction direction);
|
void showAnimated(Direction direction);
|
||||||
void showFast();
|
void showFast();
|
||||||
[[nodiscard]] bool animating() const;
|
[[nodiscard]] bool animating() const;
|
||||||
|
void setShowAnimationClipping(QRect clipping);
|
||||||
|
|
||||||
[[nodiscard]] bool hasCover() const;
|
[[nodiscard]] bool hasCover() const;
|
||||||
[[nodiscard]] virtual bool hasBack() const;
|
[[nodiscard]] virtual bool hasBack() const;
|
||||||
|
@ -142,6 +143,8 @@ private:
|
||||||
// From content top till the next button top.
|
// From content top till the next button top.
|
||||||
QPixmap contentSnapshotWas;
|
QPixmap contentSnapshotWas;
|
||||||
QPixmap contentSnapshotNow;
|
QPixmap contentSnapshotNow;
|
||||||
|
|
||||||
|
QRect clipping;
|
||||||
};
|
};
|
||||||
void updateLabelsPosition();
|
void updateLabelsPosition();
|
||||||
void paintContentSnapshot(
|
void paintContentSnapshot(
|
||||||
|
|
|
@ -639,6 +639,9 @@ void Widget::updateControlsGeometry() {
|
||||||
nextTop,
|
nextTop,
|
||||||
shownAmount);
|
shownAmount);
|
||||||
_next->moveToLeft((width() - _next->width()) / 2, realNextTop);
|
_next->moveToLeft((width() - _next->width()) / 2, realNextTop);
|
||||||
|
getStep()->setShowAnimationClipping(shownAmount > 0
|
||||||
|
? QRect(0, 0, width(), realNextTop)
|
||||||
|
: QRect());
|
||||||
if (_changeLanguage) {
|
if (_changeLanguage) {
|
||||||
_changeLanguage->moveToLeft((width() - _changeLanguage->width()) / 2, _next->y() + _next->height() + _changeLanguage->height());
|
_changeLanguage->moveToLeft((width() - _changeLanguage->width()) / 2, _next->y() + _next->height() + _changeLanguage->height());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue