diff --git a/Telegram/Resources/animations/craft_failed.tgs b/Telegram/Resources/animations/craft_failed.tgs
new file mode 100644
index 0000000000..a64ab0a7ff
Binary files /dev/null and b/Telegram/Resources/animations/craft_failed.tgs differ
diff --git a/Telegram/Resources/icons/chat/filled_forge_fail.svg b/Telegram/Resources/icons/chat/filled_forge_fail.svg
deleted file mode 100644
index 21ba5796a0..0000000000
--- a/Telegram/Resources/icons/chat/filled_forge_fail.svg
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
\ No newline at end of file
diff --git a/Telegram/Resources/qrc/telegram/animations.qrc b/Telegram/Resources/qrc/telegram/animations.qrc
index 3902bfff8b..3842e925d7 100644
--- a/Telegram/Resources/qrc/telegram/animations.qrc
+++ b/Telegram/Resources/qrc/telegram/animations.qrc
@@ -55,6 +55,7 @@
../../animations/passkeys.tgs
../../animations/ban.tgs
../../animations/cocoon.tgs
+ ../../animations/craft_failed.tgs
../../animations/profile/profile_muting.tgs
../../animations/profile/profile_unmuting.tgs
diff --git a/Telegram/SourceFiles/boxes/star_gift_craft_animation.cpp b/Telegram/SourceFiles/boxes/star_gift_craft_animation.cpp
index 0dae0f43f5..7a75148296 100644
--- a/Telegram/SourceFiles/boxes/star_gift_craft_animation.cpp
+++ b/Telegram/SourceFiles/boxes/star_gift_craft_animation.cpp
@@ -454,6 +454,10 @@ std::unique_ptr SetupFailureAnimation(
not_null canvas,
not_null state) {
auto result = std::make_unique();
+ 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 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);
diff --git a/Telegram/SourceFiles/boxes/star_gift_craft_animation.h b/Telegram/SourceFiles/boxes/star_gift_craft_animation.h
index 0df9d6fed0..c1a1aa58e1 100644
--- a/Telegram/SourceFiles/boxes/star_gift_craft_animation.h
+++ b/Telegram/SourceFiles/boxes/star_gift_craft_animation.h
@@ -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 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;
bool started = false;
int finalCoverIndex = -1;
rpl::lifetime lifetime;
diff --git a/Telegram/SourceFiles/ui/effects/credits.style b/Telegram/SourceFiles/ui/effects/credits.style
index 53fd970399..74613058f8 100644
--- a/Telegram/SourceFiles/ui/effects/credits.style
+++ b/Telegram/SourceFiles/ui/effects/credits.style
@@ -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;