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

View File

@ -61,8 +61,7 @@
<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/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_2.json">../../icons/calls/raised_hand_2.json</file>
<file alias="icons/calls/raised_hand.json">../../icons/calls/raised_hand.json</file>
</qresource>
<qresource prefix="/qt-project.org">
<file>../qmime/freedesktop.org.xml</file>

View File

@ -393,8 +393,8 @@ callErrorToast: Toast(defaultToast) {
groupCallWidth: 380px;
groupCallHeight: 580px;
groupCallMuteButtonIconSize: size(52px, 52px);
groupCallMuteButtonIconTop: 39px;
groupCallMuteButtonIconSize: size(55px, 55px);
groupCallMuteButtonIconTop: 42px;
groupCallRipple: RippleAnimation(defaultRippleAnimation) {
color: groupCallMembersBgRipple;
}

View File

@ -545,26 +545,20 @@ CallMuteButton::IconState CallMuteButton::initialState() {
_icons[0].emplace(Lottie::IconDescriptor{
.path = u":/gui/icons/calls/hand_muted_active.json"_q,
.color = st::groupCallIconFg,
//.sizeOverride = st::groupCallMuteButtonIconSize,
.sizeOverride = st::groupCallMuteButtonIconSize,
.frame = 22,
});
_icons[1].emplace(Lottie::IconDescriptor{
.path = u":/gui/icons/calls/active_hand.json"_q,
.color = st::groupCallIconFg,
//.sizeOverride = st::groupCallMuteButtonIconSize,
.frame = 1,
.sizeOverride = st::groupCallMuteButtonIconSize,
.frame = 0,
});
_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,
//.sizeOverride = st::groupCallMuteButtonIconSize,
.frame = 1,
});
_icons[3].emplace(Lottie::IconDescriptor{
.path = u":/gui/icons/calls/raised_hand_2.json"_q,
.color = st::groupCallIconFg,
//.sizeOverride = st::groupCallMuteButtonIconSize,
.frame = 1,
.sizeOverride = st::groupCallMuteButtonIconSize,
.frame = 0,
});
return iconStateFrom(_state.current().type);
}
@ -667,7 +661,7 @@ CallMuteButton::IconState CallMuteButton::iconStateFrom(
}
CallMuteButton::IconState CallMuteButton::randomWavingState() {
switch (openssl::RandomValue<uint32>() % 7) {
switch (openssl::RandomValue<uint32>() % 5) {
case 0: return {
.icon = &*_icons[2],
.frameFrom = 0,
@ -685,17 +679,9 @@ CallMuteButton::IconState CallMuteButton::randomWavingState() {
.frameFrom = 420,
.frameTo = 540 };
case 4: return {
.icon = &*_icons[3],
.frameFrom = 0,
.frameTo = 240 };
case 5: return {
.icon = &*_icons[3],
.frameFrom = 240,
.frameTo = 480 };
case 6: return {
.icon = &*_icons[3],
.frameFrom = 480,
.frameTo = 660 };
.icon = &*_icons[2],
.frameFrom = 540,
.frameTo = 720 };
}
Unexpected("Value in CallMuteButton::randomWavingState.");
}

View File

@ -140,7 +140,7 @@ private:
std::unique_ptr<InfiniteRadialAnimation> _radial;
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;
std::optional<IconState> _scheduledState;