mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added fade effect to ministars from custom top bar in premium settings.
This commit is contained in:
parent
7749fadf11
commit
443d40906d
1 changed files with 12 additions and 6 deletions
|
@ -321,19 +321,25 @@ void MiniStars::paint(Painter &p, const QRectF &rect) {
|
||||||
const auto alphaProgress = 1.
|
const auto alphaProgress = 1.
|
||||||
- (std::clamp(progress - _disappearProgressAfter, 0., 1.)
|
- (std::clamp(progress - _disappearProgressAfter, 0., 1.)
|
||||||
/ (1. - _disappearProgressAfter));
|
/ (1. - _disappearProgressAfter));
|
||||||
p.setOpacity(ministar.alpha * alphaProgress * appearProgress);
|
p.setOpacity(ministar.alpha
|
||||||
|
* alphaProgress
|
||||||
|
* appearProgress
|
||||||
|
* opacity);
|
||||||
|
|
||||||
const auto distanceProgress = _distanceProgressStart + progress;
|
const auto distanceProgress = _distanceProgressStart + progress;
|
||||||
const auto starSize = ministar.size * appearProgress;
|
const auto starSide = ministar.size * appearProgress;
|
||||||
|
const auto widthFade = (std::abs(rcos) >= std::abs(rsin));
|
||||||
|
const auto starWidth = starSide * (widthFade ? alphaProgress : 1.);
|
||||||
|
const auto starHeight = starSide * (!widthFade ? alphaProgress : 1.);
|
||||||
_sprite.render(&p, QRectF(
|
_sprite.render(&p, QRectF(
|
||||||
center.x()
|
center.x()
|
||||||
+ anim::interpolateF(0, end.x(), distanceProgress)
|
+ anim::interpolateF(0, end.x(), distanceProgress)
|
||||||
- starSize / 2.,
|
- starWidth / 2.,
|
||||||
center.y()
|
center.y()
|
||||||
+ anim::interpolateF(0, end.y(), distanceProgress)
|
+ anim::interpolateF(0, end.y(), distanceProgress)
|
||||||
- starSize / 2.,
|
- starHeight / 2.,
|
||||||
starSize,
|
starWidth,
|
||||||
starSize));
|
starHeight));
|
||||||
}
|
}
|
||||||
p.setOpacity(opacity);
|
p.setOpacity(opacity);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue