Added fade effect to ministars from custom top bar in premium settings.

This commit is contained in:
23rd 2022-05-29 02:13:24 +03:00
parent 7749fadf11
commit 443d40906d

View file

@ -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);
} }