From 6ae15485adc8d56d515789f576ce7597488c5c04 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 29 Oct 2020 03:32:24 +0300 Subject: [PATCH] Added show animation to VoiceRecordButton. --- .../view/controls/history_view_voice_record_button.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_button.cpp b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_button.cpp index bb9b81c0e..2cd2da163 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_voice_record_button.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_voice_record_button.cpp @@ -635,7 +635,13 @@ void VoiceRecordButton::init() { ) | rpl::start_with_next([=](const QRect &clip) { Painter p(this); + const auto progress = _showProgress.current(); + const auto complete = (progress == 1.); + p.translate(_center, _center); + if (!complete) { + p.scale(progress, progress); + } PainterHighQualityEnabler hq(p); const auto color = anim::color( st::historyRecordSignalColor, @@ -644,7 +650,9 @@ void VoiceRecordButton::init() { _recordCircle->paint(p, color); p.resetTransform(); - p.setOpacity(_showProgress.current()); + if (!complete) { + p.setOpacity(progress); + } st::historyRecordVoiceActive.paintInCenter(p, rect()); }, lifetime());