Improve voice chat lottie animations.

This commit is contained in:
John Preston
2021-03-13 15:24:06 +04:00
parent ae5c7b19f6
commit fb7a8cae33
9 changed files with 17 additions and 33 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -2
View File
@@ -61,8 +61,7 @@
<file alias="night-green.tdesktop-theme">../../night-green.tdesktop-theme</file> <file alias="night-green.tdesktop-theme">../../night-green.tdesktop-theme</file>
<file alias="icons/calls/active_hand.json">../../icons/calls/active_hand.json</file> <file alias="icons/calls/active_hand.json">../../icons/calls/active_hand.json</file>
<file alias="icons/calls/hand_muted_active.json">../../icons/calls/hand_muted_active.json</file> <file alias="icons/calls/hand_muted_active.json">../../icons/calls/hand_muted_active.json</file>
<file alias="icons/calls/raised_hand_1.json">../../icons/calls/raised_hand_1.json</file> <file alias="icons/calls/raised_hand.json">../../icons/calls/raised_hand.json</file>
<file alias="icons/calls/raised_hand_2.json">../../icons/calls/raised_hand_2.json</file>
</qresource> </qresource>
<qresource prefix="/qt-project.org"> <qresource prefix="/qt-project.org">
<file>../qmime/freedesktop.org.xml</file> <file>../qmime/freedesktop.org.xml</file>
+2 -2
View File
@@ -393,8 +393,8 @@ callErrorToast: Toast(defaultToast) {
groupCallWidth: 380px; groupCallWidth: 380px;
groupCallHeight: 580px; groupCallHeight: 580px;
groupCallMuteButtonIconSize: size(52px, 52px); groupCallMuteButtonIconSize: size(55px, 55px);
groupCallMuteButtonIconTop: 39px; groupCallMuteButtonIconTop: 42px;
groupCallRipple: RippleAnimation(defaultRippleAnimation) { groupCallRipple: RippleAnimation(defaultRippleAnimation) {
color: groupCallMembersBgRipple; color: groupCallMembersBgRipple;
} }
@@ -545,26 +545,20 @@ CallMuteButton::IconState CallMuteButton::initialState() {
_icons[0].emplace(Lottie::IconDescriptor{ _icons[0].emplace(Lottie::IconDescriptor{
.path = u":/gui/icons/calls/hand_muted_active.json"_q, .path = u":/gui/icons/calls/hand_muted_active.json"_q,
.color = st::groupCallIconFg, .color = st::groupCallIconFg,
//.sizeOverride = st::groupCallMuteButtonIconSize, .sizeOverride = st::groupCallMuteButtonIconSize,
.frame = 22, .frame = 22,
}); });
_icons[1].emplace(Lottie::IconDescriptor{ _icons[1].emplace(Lottie::IconDescriptor{
.path = u":/gui/icons/calls/active_hand.json"_q, .path = u":/gui/icons/calls/active_hand.json"_q,
.color = st::groupCallIconFg, .color = st::groupCallIconFg,
//.sizeOverride = st::groupCallMuteButtonIconSize, .sizeOverride = st::groupCallMuteButtonIconSize,
.frame = 1, .frame = 0,
}); });
_icons[2].emplace(Lottie::IconDescriptor{ _icons[2].emplace(Lottie::IconDescriptor{
.path = u":/gui/icons/calls/raised_hand_1.json"_q, .path = u":/gui/icons/calls/raised_hand.json"_q,
.color = st::groupCallIconFg, .color = st::groupCallIconFg,
//.sizeOverride = st::groupCallMuteButtonIconSize, .sizeOverride = st::groupCallMuteButtonIconSize,
.frame = 1, .frame = 0,
});
_icons[3].emplace(Lottie::IconDescriptor{
.path = u":/gui/icons/calls/raised_hand_2.json"_q,
.color = st::groupCallIconFg,
//.sizeOverride = st::groupCallMuteButtonIconSize,
.frame = 1,
}); });
return iconStateFrom(_state.current().type); return iconStateFrom(_state.current().type);
} }
@@ -667,7 +661,7 @@ CallMuteButton::IconState CallMuteButton::iconStateFrom(
} }
CallMuteButton::IconState CallMuteButton::randomWavingState() { CallMuteButton::IconState CallMuteButton::randomWavingState() {
switch (openssl::RandomValue<uint32>() % 7) { switch (openssl::RandomValue<uint32>() % 5) {
case 0: return { case 0: return {
.icon = &*_icons[2], .icon = &*_icons[2],
.frameFrom = 0, .frameFrom = 0,
@@ -685,17 +679,9 @@ CallMuteButton::IconState CallMuteButton::randomWavingState() {
.frameFrom = 420, .frameFrom = 420,
.frameTo = 540 }; .frameTo = 540 };
case 4: return { case 4: return {
.icon = &*_icons[3], .icon = &*_icons[2],
.frameFrom = 0, .frameFrom = 540,
.frameTo = 240 }; .frameTo = 720 };
case 5: return {
.icon = &*_icons[3],
.frameFrom = 240,
.frameTo = 480 };
case 6: return {
.icon = &*_icons[3],
.frameFrom = 480,
.frameTo = 660 };
} }
Unexpected("Value in CallMuteButton::randomWavingState."); Unexpected("Value in CallMuteButton::randomWavingState.");
} }
@@ -140,7 +140,7 @@ private:
std::unique_ptr<InfiniteRadialAnimation> _radial; std::unique_ptr<InfiniteRadialAnimation> _radial;
const base::flat_map<CallMuteButtonType, anim::gradient_colors> _colors; const base::flat_map<CallMuteButtonType, anim::gradient_colors> _colors;
std::array<std::optional<Lottie::Icon>, 4> _icons; std::array<std::optional<Lottie::Icon>, 3> _icons;
IconState _iconState; IconState _iconState;
std::optional<IconState> _scheduledState; std::optional<IconState> _scheduledState;