mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Display lottie on craft failure.
This commit is contained in:
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="72px" height="72px" viewBox="0 0 72 72" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Profile / filled_gift_broken</title>
|
||||
<g id="Profile-/-filled_gift_broken" stroke="none" fill="none" fill-rule="nonzero">
|
||||
<path d="M44.01,42.471 L58.9144129,43.4329741 C59.1317384,43.4469887 59.3445298,43.432761 59.549137,43.3933961 L58.2743575,61.6159362 C57.966154,66.0234515 54.1433086,69.3466003 49.7357933,69.0383968 L34.314,67.96 L46.1422991,46.6629464 L44.01,42.471 Z M32.668,41.027 L32.6158159,41.2978516 L36.4362986,47.0097656 L28.513,67.531 L21.2642067,68.0383968 C16.8566914,68.3466003 13.033846,65.0234515 12.7256425,60.6159362 L11.4595625,42.5101487 L32.668,41.027 Z M52.7544291,6.27336698 C52.9779475,6.39016761 53.1973457,6.514516 53.4126237,6.64641215 C55.0176557,7.62977987 56.2616486,8.92407226 57.1446026,10.5292893 C58.0275565,12.1345064 58.4001354,13.9224034 58.2623393,15.8929805 C58.1684413,17.2357837 57.8224168,18.4521068 57.2242656,19.5419496 C56.6925757,20.5106988 56.0170589,21.3556211 55.197715,22.0767164 L54.947,22.287 L62.9899881,22.8504512 C65.1937457,23.0045529 66.8553201,24.9159756 66.7012184,27.1197333 L66.352436,32.1075535 C66.1983343,34.3113112 64.2869115,35.9728856 62.0831539,35.8187838 L60.0880258,35.6792709 L60.0842427,35.744126 C59.9555848,35.7045582 59.8222579,35.6750041 59.6850985,35.6564261 L59.5214942,35.6396551 L42.96,34.481 L47.4954306,21.4249821 C48.4590745,21.2117744 49.3030651,20.8424669 50.0274024,20.3170595 L50.2466035,20.1503864 C51.6827465,19.0063596 52.4591898,17.5995902 52.5759335,15.9300781 C52.690162,14.296534 52.2359988,12.9791603 51.2134438,11.9779569 C51.1056746,11.872438 50.9940848,11.7718151 50.8786746,11.6760885 L52.7544291,6.27336698 Z M40.1952262,2.97031672 L38.9606472,9.21627213 C38.5526755,9.51211515 38.1719562,9.86109597 37.8184893,10.2632146 C36.6644316,11.5761188 36.5026282,13.2206286 36.6207581,15.2465546 L36.919,19.536 L34.247,33.047 L8.9168461,34.8187838 C6.71308845,34.9728856 4.80166575,33.3113112 4.647564,31.1075535 L4.29878163,26.1197333 C4.14467989,23.9159756 5.80625429,22.0045529 8.01001194,21.8504512 L15.6498801,21.3165167 C14.7171227,20.5507566 13.9584272,19.6352697 13.3737936,18.5700561 C12.7756425,17.4802132 12.429618,16.2638902 12.33572,14.9210869 C12.1979239,12.9505099 12.5705893,11.1626068 13.4537162,9.55737761 C14.3368432,7.95214845 15.5858537,6.65750519 17.2007477,5.67344785 C18.8156417,4.68939051 20.6447641,4.12591933 22.688115,3.98303432 C24.9601966,3.8241549 27.0227818,4.26215829 28.8758706,5.29704452 C30.7289594,6.33193074 32.1218402,7.88166841 33.054513,9.94625754 C33.6907738,7.77195789 34.8493133,6.04380752 36.5301315,4.76180645 C37.6260713,3.92590641 38.8477695,3.32874316 40.1952262,2.97031672 Z M23.5142475,9.32274237 C21.7840605,9.44372884 20.4070839,10.0048661 19.3833178,11.0061541 C18.3595517,12.0074421 17.9047829,13.3248582 18.0190115,14.9584023 C18.1357551,16.6279144 18.9127175,18.0346475 20.3498986,19.1786018 C21.535467,20.1222797 23.0636284,20.6185744 24.9343828,20.6674858 L30.963891,20.2443571 L30.6654633,15.9711247 C30.5218807,13.9177968 29.8222681,12.3001314 28.5666257,11.1181284 L28.3522035,10.9251618 C26.9615898,9.72858813 25.3489378,9.19444833 23.5142475,9.32274237 Z" id="Shape" fill="#FFFFFF"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.3 KiB |
@@ -55,6 +55,7 @@
|
||||
<file alias="passkeys.tgs">../../animations/passkeys.tgs</file>
|
||||
<file alias="ban.tgs">../../animations/ban.tgs</file>
|
||||
<file alias="cocoon.tgs">../../animations/cocoon.tgs</file>
|
||||
<file alias="craft_failed.tgs">../../animations/craft_failed.tgs</file>
|
||||
|
||||
<file alias="profile_muting.tgs">../../animations/profile/profile_muting.tgs</file>
|
||||
<file alias="profile_unmuting.tgs">../../animations/profile/profile_unmuting.tgs</file>
|
||||
|
||||
@@ -454,6 +454,10 @@ std::unique_ptr<CraftFailAnimation> SetupFailureAnimation(
|
||||
not_null<RpWidget*> canvas,
|
||||
not_null<CraftAnimationState*> state) {
|
||||
auto result = std::make_unique<CraftFailAnimation>();
|
||||
result->lottie = Lottie::MakeIcon({
|
||||
.name = u"craft_failed"_q,
|
||||
.sizeOverride = st::craftFailLottieSize,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -491,6 +495,13 @@ void FailureAnimationCheck(
|
||||
}
|
||||
}
|
||||
|
||||
const auto lottie = animation->lottie.get();
|
||||
if (lottie->framesCount() > 1) {
|
||||
lottie->animate([=] {
|
||||
canvas->update();
|
||||
}, 0, lottie->framesCount() - 1);
|
||||
}
|
||||
|
||||
state->failureShown = true;
|
||||
state->progressShown = false;
|
||||
}
|
||||
@@ -534,7 +545,7 @@ void FailureAnimationPrepareFrame(
|
||||
} else {
|
||||
p.fillRect(rect, bg);
|
||||
}
|
||||
st::craftFail.paintInCenter(p, rect, st::white->c);
|
||||
animation->lottie->paintInCenter(p, rect);
|
||||
p.setOpacity(progress);
|
||||
p.drawImage(
|
||||
st::craftForgePadding,
|
||||
@@ -1317,9 +1328,7 @@ void CraftState::updateForGiftCount(int count, Fn<void()> repaint) {
|
||||
}
|
||||
}
|
||||
|
||||
CraftState::EmptySide CraftState::prepareEmptySide(
|
||||
int index,
|
||||
bool fail) const {
|
||||
CraftState::EmptySide CraftState::prepareEmptySide(int index) const {
|
||||
const auto size = forgeRect.size();
|
||||
const auto ratio = style::DevicePixelRatio();
|
||||
auto result = QImage(size * ratio, QImage::Format_ARGB32_Premultiplied);
|
||||
@@ -1329,11 +1338,7 @@ CraftState::EmptySide CraftState::prepareEmptySide(
|
||||
result.fill(bg);
|
||||
|
||||
auto p = QPainter(&result);
|
||||
if (fail) {
|
||||
st::craftFail.paintInCenter(p, QRect(QPoint(), size), st::white->c);
|
||||
} else {
|
||||
st::craftForge.paintInCenter(p, QRect(QPoint(), size), st::white->c);
|
||||
}
|
||||
st::craftForge.paintInCenter(p, QRect(QPoint(), size), st::white->c);
|
||||
|
||||
//#if _DEBUG
|
||||
// p.setFont(st::semiboldFont);
|
||||
|
||||
@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_star_gift.h"
|
||||
#include "ui/effects/animations.h"
|
||||
#include "ui/effects/radial_animation.h"
|
||||
#include "lottie/lottie_icon.h"
|
||||
#include "ui/text/text_custom_emoji.h"
|
||||
|
||||
namespace ChatHelpers {
|
||||
@@ -135,9 +136,7 @@ struct CraftState {
|
||||
int craftingHeight,
|
||||
float64 slideProgress = 0.);
|
||||
void updateForGiftCount(int count, Fn<void()> repaint);
|
||||
[[nodiscard]] EmptySide prepareEmptySide(
|
||||
int index,
|
||||
bool fail = false) const;
|
||||
[[nodiscard]] EmptySide prepareEmptySide(int index) const;
|
||||
};
|
||||
|
||||
struct FacePlacement {
|
||||
@@ -160,6 +159,7 @@ struct CraftDoneAnimation {
|
||||
|
||||
struct CraftFailAnimation {
|
||||
QImage frame;
|
||||
std::unique_ptr<Lottie::Icon> lottie;
|
||||
bool started = false;
|
||||
int finalCoverIndex = -1;
|
||||
rpl::lifetime lifetime;
|
||||
|
||||
@@ -638,7 +638,7 @@ craftFailureTitleMargin: margins(0px, 88px, 0px, 12px);
|
||||
craftFailureAboutMargin: margins(0px, 0px, 0px, 16px);
|
||||
|
||||
craftForge: icon{{ "chat/filled_forge-48x48", windowFg }};
|
||||
craftFail: icon{{ "chat/filled_forge_fail-36x36", windowFg }};
|
||||
craftFailLottieSize: size(36px, 36px);
|
||||
craftForgePadding: 12px;
|
||||
craftForgePercent: CraftRadialPercent {
|
||||
stroke: 4px;
|
||||
|
||||
Reference in New Issue
Block a user