Fixed delta time computing in BlobsWidget.
This commit is contained in:
parent
dffa36ede4
commit
87ee83bc73
1 changed files with 7 additions and 3 deletions
|
|
@ -144,6 +144,8 @@ private:
|
||||||
int _center = 0;
|
int _center = 0;
|
||||||
QRect _inner;
|
QRect _inner;
|
||||||
|
|
||||||
|
crl::time _blobsLastTime = 0;
|
||||||
|
|
||||||
Animations::Basic _animation;
|
Animations::Basic _animation;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -152,7 +154,8 @@ BlobsWidget::BlobsWidget(not_null<RpWidget*> parent)
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
, _blobs(MuteBlobs() | ranges::to_vector, kLevelDuration, kMaxLevel)
|
, _blobs(MuteBlobs() | ranges::to_vector, kLevelDuration, kMaxLevel)
|
||||||
, _blobBrush(Qt::transparent)
|
, _blobBrush(Qt::transparent)
|
||||||
, _glowBrush(Qt::transparent) {
|
, _glowBrush(Qt::transparent)
|
||||||
|
, _blobsLastTime(crl::now()) {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -203,8 +206,9 @@ void BlobsWidget::init() {
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
_animation.init([=](crl::time now) {
|
_animation.init([=](crl::time now) {
|
||||||
const auto dt = now - _animation.started();
|
_blobs.updateLevel(now - _blobsLastTime);
|
||||||
_blobs.updateLevel(dt);
|
_blobsLastTime = now;
|
||||||
|
|
||||||
update();
|
update();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue