Slightly improved connecting animation in mute button.
This commit is contained in:
parent
bab4cfa5aa
commit
17eb0f22b4
1 changed files with 35 additions and 18 deletions
|
|
@ -328,6 +328,15 @@ BlobsWidget::BlobsWidget(
|
||||||
void BlobsWidget::init() {
|
void BlobsWidget::init() {
|
||||||
setAttribute(Qt::WA_TransparentForMouseEvents);
|
setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
|
||||||
|
const auto cutRect = [](Painter &p, const QRectF &r) {
|
||||||
|
p.save();
|
||||||
|
p.setOpacity(1.);
|
||||||
|
p.setBrush(st::groupCallBg);
|
||||||
|
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||||
|
p.drawEllipse(r);
|
||||||
|
p.restore();
|
||||||
|
};
|
||||||
|
|
||||||
{
|
{
|
||||||
const auto s = _blobs.maxRadius() * 2 * kGlowPaddingFactor;
|
const auto s = _blobs.maxRadius() * 2 * kGlowPaddingFactor;
|
||||||
resize(s, s);
|
resize(s, s);
|
||||||
|
|
@ -351,6 +360,8 @@ void BlobsWidget::init() {
|
||||||
Painter p(this);
|
Painter p(this);
|
||||||
PainterHighQualityEnabler hq(p);
|
PainterHighQualityEnabler hq(p);
|
||||||
|
|
||||||
|
p.setPen(Qt::NoPen);
|
||||||
|
|
||||||
// Glow.
|
// Glow.
|
||||||
const auto s = kGlowMinScale
|
const auto s = kGlowMinScale
|
||||||
+ (1. - kGlowMinScale) * _blobs.currentLevel();
|
+ (1. - kGlowMinScale) * _blobs.currentLevel();
|
||||||
|
|
@ -369,37 +380,41 @@ void BlobsWidget::init() {
|
||||||
_switchConnectingProgress / kBlobPartAnimation)))
|
_switchConnectingProgress / kBlobPartAnimation)))
|
||||||
: _blobsScaleEnter;
|
: _blobsScaleEnter;
|
||||||
_blobs.paint(p, _blobBrush, scale);
|
_blobs.paint(p, _blobBrush, scale);
|
||||||
|
p.translate(-_center, -_center);
|
||||||
|
|
||||||
|
if (scale < 1.) {
|
||||||
|
cutRect(p, _circleRect);
|
||||||
|
}
|
||||||
|
|
||||||
// Main circle.
|
// Main circle.
|
||||||
p.translate(-_center, -_center);
|
|
||||||
p.setPen(Qt::NoPen);
|
|
||||||
p.setBrush(_blobBrush);
|
|
||||||
p.drawEllipse(_circleRect);
|
|
||||||
|
|
||||||
if (_switchConnectingProgress > 0.) {
|
|
||||||
p.resetTransform();
|
|
||||||
|
|
||||||
const auto circleProgress =
|
const auto circleProgress =
|
||||||
Clamp(_switchConnectingProgress - kBlobPartAnimation)
|
Clamp(_switchConnectingProgress - kBlobPartAnimation)
|
||||||
/ kFillCirclePartAnimation;
|
/ kFillCirclePartAnimation;
|
||||||
|
const auto skipColoredCircle = (circleProgress == 1.);
|
||||||
|
|
||||||
|
if (!skipColoredCircle) {
|
||||||
|
p.setBrush(_blobBrush);
|
||||||
|
p.drawEllipse(_circleRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_switchConnectingProgress > 0.) {
|
||||||
|
p.resetTransform();
|
||||||
|
|
||||||
const auto mF = (_circleRect.width() / 2) * (1. - circleProgress);
|
const auto mF = (_circleRect.width() / 2) * (1. - circleProgress);
|
||||||
const auto cutOutRect = _circleRect.marginsRemoved(
|
const auto cutOutRect = _circleRect.marginsRemoved(
|
||||||
QMarginsF(mF, mF, mF, mF));
|
QMarginsF(mF, mF, mF, mF));
|
||||||
|
|
||||||
p.setPen(Qt::NoPen);
|
if (!skipColoredCircle) {
|
||||||
p.setBrush(st::callConnectingRadial.color);
|
p.setBrush(st::callConnectingRadial.color);
|
||||||
p.setOpacity(circleProgress);
|
p.setOpacity(circleProgress);
|
||||||
p.drawEllipse(_circleRect);
|
p.drawEllipse(_circleRect);
|
||||||
|
}
|
||||||
|
|
||||||
p.setOpacity(1.);
|
p.setOpacity(1.);
|
||||||
|
|
||||||
|
cutRect(p, cutOutRect);
|
||||||
|
|
||||||
p.setBrush(st::callIconBg);
|
p.setBrush(st::callIconBg);
|
||||||
|
|
||||||
p.save();
|
|
||||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
|
||||||
p.drawEllipse(cutOutRect);
|
|
||||||
p.restore();
|
|
||||||
|
|
||||||
p.drawEllipse(cutOutRect);
|
p.drawEllipse(cutOutRect);
|
||||||
}
|
}
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
@ -729,6 +744,8 @@ void CallMuteButton::init() {
|
||||||
const auto to = r.arcFrom - kRadialFinishArcShift;
|
const auto to = r.arcFrom - kRadialFinishArcShift;
|
||||||
ComputeRadialFinish(r.arcFrom, radialProgress, to);
|
ComputeRadialFinish(r.arcFrom, radialProgress, to);
|
||||||
ComputeRadialFinish(r.arcLength, radialProgress);
|
ComputeRadialFinish(r.arcLength, radialProgress);
|
||||||
|
} else {
|
||||||
|
r.arcLength = RadialState::kFull;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto opacity = (radialProgress > kOverlapProgressRadialHide)
|
const auto opacity = (radialProgress > kOverlapProgressRadialHide)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue