From 4761b307b44db51bc48ad287250b436ad0f84dd0 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 30 Nov 2020 20:08:24 +0300 Subject: [PATCH] Fixed reversed animations in mute button. --- ui/widgets/call_mute_button.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/widgets/call_mute_button.cpp b/ui/widgets/call_mute_button.cpp index f001baa..d03f154 100644 --- a/ui/widgets/call_mute_button.cpp +++ b/ui/widgets/call_mute_button.cpp @@ -321,7 +321,9 @@ void CallMuteButton::init() { blobsInner.center(), _blobs->width() / 2); - const auto from = 0.; + const auto from = _switchAnimation.animating() + ? (1. - _switchAnimation.value(0.)) + : 0.; const auto to = 1.; auto callback = [=](float64 value) { @@ -348,7 +350,7 @@ void CallMuteButton::init() { }; _switchAnimation.stop(); - const auto duration = kSwitchStateDuration; + const auto duration = (1. - from) * kSwitchStateDuration; _switchAnimation.start(std::move(callback), from, to, duration); }, lifetime());