Slightly improved animation of top bar in premium settings.
This commit is contained in:
parent
ee9a04393e
commit
a73676b3ba
|
@ -270,20 +270,23 @@ void TopBar::paintEvent(QPaintEvent *e) {
|
||||||
|
|
||||||
p.setOpacity(bodyProgress);
|
p.setOpacity(bodyProgress);
|
||||||
|
|
||||||
const auto &starSize = st::settingsPremiumStarSize;
|
const auto starRect = [&](float64 topProgress, float64 sizeProgress) {
|
||||||
const auto starRect = QRectF(
|
const auto starSize = st::settingsPremiumStarSize * sizeProgress;
|
||||||
|
return QRectF(
|
||||||
QPointF(
|
QPointF(
|
||||||
(width() - starSize.width()) / 2,
|
(width() - starSize.width()) / 2,
|
||||||
st::settingsPremiumStarTopSkip * topProgress),
|
st::settingsPremiumStarTopSkip * topProgress),
|
||||||
st::settingsPremiumStarSize);
|
starSize);
|
||||||
_star.render(&p, starRect);
|
};
|
||||||
|
const auto currentStarRect = starRect(topProgress, bodyProgress);
|
||||||
|
_star.render(&p, currentStarRect);
|
||||||
|
|
||||||
p.setPen(st::premiumButtonFg);
|
p.setPen(st::premiumButtonFg);
|
||||||
|
|
||||||
const auto &padding = st::boxRowPadding;
|
const auto &padding = st::boxRowPadding;
|
||||||
const auto availableWidth = width() - padding.left() - padding.right();
|
const auto availableWidth = width() - padding.left() - padding.right();
|
||||||
const auto titleTop = starRect.top()
|
const auto titleTop = currentStarRect.top()
|
||||||
+ starRect.height()
|
+ currentStarRect.height()
|
||||||
+ st::changePhoneTitlePadding.top();
|
+ st::changePhoneTitlePadding.top();
|
||||||
const auto aboutTop = titleTop
|
const auto aboutTop = titleTop
|
||||||
+ _title.countHeight(availableWidth)
|
+ _title.countHeight(availableWidth)
|
||||||
|
@ -292,26 +295,23 @@ void TopBar::paintEvent(QPaintEvent *e) {
|
||||||
p.setFont(st::aboutLabel.style.font);
|
p.setFont(st::aboutLabel.style.font);
|
||||||
_about.draw(p, padding.left(), aboutTop, availableWidth, style::al_top);
|
_about.draw(p, padding.left(), aboutTop, availableWidth, style::al_top);
|
||||||
|
|
||||||
// Subtitle.
|
|
||||||
p.setFont(st::boxTitle.style.font);
|
|
||||||
_title.draw(p, padding.left(), titleTop, availableWidth, style::al_top);
|
|
||||||
|
|
||||||
// Title.
|
// Title.
|
||||||
const auto titleProgress =
|
p.setOpacity(1.);
|
||||||
std::clamp(
|
p.setFont(st::boxTitle.style.font);
|
||||||
(kTitleAnimationPart - progress) / kTitleAnimationPart,
|
const auto titleProgress = 1. - progress;
|
||||||
0.,
|
const auto fullStarRect = starRect(1., 1.);
|
||||||
1.);
|
const auto fullTitleTop = fullStarRect.top()
|
||||||
if (titleProgress > 0.) {
|
+ fullStarRect.height()
|
||||||
p.setOpacity(titleProgress);
|
+ st::changePhoneTitlePadding.top();
|
||||||
const auto availableWidth = width() - _titlePosition.x() * 2;
|
_title.draw(
|
||||||
_title.drawElided(
|
|
||||||
p,
|
p,
|
||||||
|
anim::interpolate(
|
||||||
|
(width() - _title.countWidth(availableWidth)) / 2,
|
||||||
_titlePosition.x(),
|
_titlePosition.x(),
|
||||||
_titlePosition.y(),
|
titleProgress),
|
||||||
|
anim::interpolate(fullTitleTop, _titlePosition.y(), titleProgress),
|
||||||
availableWidth);
|
availableWidth);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
class Premium : public Section<Premium> {
|
class Premium : public Section<Premium> {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue