2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Use new animations engine everywhere.

This commit is contained in:
John Preston
2019-04-02 13:13:30 +04:00
parent a6e96f9a28
commit 99bb09374d
162 changed files with 753 additions and 826 deletions

View File

@@ -489,12 +489,12 @@ void Widget::showAnimated(const QPixmap &bgAnimCache, bool back) {
(_showBack ? _cacheOver : _cacheUnder) = bgAnimCache;
_a_show.finish();
_a_show.stop();
showControls();
(_showBack ? _cacheUnder : _cacheOver) = Ui::GrabWidget(this);
hideControls();
_a_show.start([this] { animationCallback(); }, 0., 1., st::slideDuration, Window::SlideAnimation::transition());
_a_show.start([=] { animationCallback(); }, 0., 1., st::slideDuration, Window::SlideAnimation::transition());
show();
}
@@ -513,16 +513,12 @@ void Widget::paintEvent(QPaintEvent *e) {
bool trivial = (rect() == e->rect());
setMouseTracking(true);
if (_coverShownAnimation.animating()) {
_coverShownAnimation.step(crl::now());
}
QPainter p(this);
if (!trivial) {
p.setClipRect(e->rect());
}
p.fillRect(e->rect(), st::windowBg);
auto progress = _a_show.current(crl::now(), 1.);
auto progress = _a_show.value(1.);
if (_a_show.animating()) {
auto coordUnder = _showBack ? anim::interpolate(-st::slideShift, 0, progress) : anim::interpolate(0, -st::slideShift, progress);
auto coordOver = _showBack ? anim::interpolate(0, width(), progress) : anim::interpolate(width(), 0, progress);
@@ -559,7 +555,7 @@ void Widget::resizeEvent(QResizeEvent *e) {
}
void Widget::updateControlsGeometry() {
auto shown = _coverShownAnimation.current(1.);
auto shown = _coverShownAnimation.value(1.);
auto controlsTopTo = getStep()->hasCover() ? st::introCoverHeight : 0;
auto controlsTop = anim::interpolate(_controlsTopFrom, controlsTopTo, shown);
@@ -701,7 +697,7 @@ void Widget::Step::refreshLang() {
}
void Widget::Step::showFinished() {
_a_show.finish();
_a_show.stop();
_coverAnimation = CoverAnimation();
_slideAnimation.reset();
prepareCoverMask();
@@ -710,7 +706,7 @@ void Widget::Step::showFinished() {
bool Widget::Step::paintAnimated(Painter &p, QRect clip) {
if (_slideAnimation) {
_slideAnimation->paintFrame(p, (width() - st::introStepWidth) / 2, contentTop(), width(), crl::now());
_slideAnimation->paintFrame(p, (width() - st::introStepWidth) / 2, contentTop(), width());
if (!_slideAnimation->animating()) {
showFinished();
return false;
@@ -718,7 +714,7 @@ bool Widget::Step::paintAnimated(Painter &p, QRect clip) {
return true;
}
auto dt = _a_show.current(crl::now(), 1.);
auto dt = _a_show.value(1.);
if (!_a_show.animating()) {
if (hasCover()) {
paintCover(p, 0);