diff --git a/app/components/Settings/BottomScreen/Menus/Clock/Achievements.vue b/app/components/Settings/BottomScreen/Menus/Clock/Achievements.vue index 59fdfb5..34eec9f 100644 --- a/app/components/Settings/BottomScreen/Menus/Clock/Achievements.vue +++ b/app/components/Settings/BottomScreen/Menus/Clock/Achievements.vue @@ -33,9 +33,9 @@ const achievements = useAchievementsStore(); const achievementsScreen = useAchievementsScreen(); const confirmationModal = useConfirmationModal(); -const isAnimating = ref(true); +const comingFromAchievements = store.returningFromAchievements; -const comingFromAchievements = app.previousScreen === "achievements"; +const isAnimating = ref(!comingFromAchievements); const bLabel = ref(comingFromAchievements ? $t("common.cancel") : $t("common.goBack")); const aLabel = ref(comingFromAchievements ? $t("common.reset") : $t("common.select")); @@ -46,9 +46,9 @@ const ARROW_SLIDE_DURATION = 0.167; const VIEW_ALL_OFFSET = -20; const animation = reactive({ - offsetY: SLIDE_OFFSET, - opacity: 0, - viewAllOffsetY: VIEW_ALL_OFFSET, + offsetY: comingFromAchievements ? 0 : SLIDE_OFFSET, + opacity: comingFromAchievements ? 1 : 0, + viewAllOffsetY: comingFromAchievements ? 0 : VIEW_ALL_OFFSET, }); const obtainedRef = @@ -107,13 +107,10 @@ const animateOutro = async () => { }; onMounted(() => { + store.returningFromAchievements = false; if (comingFromAchievements) { obtainedRef.value?.showInstant(); totalRef.value?.showInstant(); - animation.offsetY = 0; - animation.opacity = 1; - animation.viewAllOffsetY = 0; - isAnimating.value = false; return; } animateIntro(); @@ -142,6 +139,7 @@ const handleReset = () => { const handleVisitAll = () => { if (isAnimating.value) return; assets.audio.menuOpen.play(); + store.returningFromAchievements = true; achievementsScreen.animateFadeToBlackIntro(); }; @@ -174,7 +172,7 @@ onRender((ctx) => { ? APP_COLOR_TO_FONT_COLOR[app.color.hex]! : "#fbfbfb"; ctx.fillText("/", 7 * 16 + 3, 4 * 16 + 4 + 39); -}); +}, 5); onRender((ctx) => { ctx.translate(0, animation.viewAllOffsetY); diff --git a/app/stores/settings.ts b/app/stores/settings.ts index 7f5f07a..8b13805 100644 --- a/app/stores/settings.ts +++ b/app/stores/settings.ts @@ -58,6 +58,8 @@ export const useSettingsStore = defineStore("settings", { isIntro: true, isOutro: false, + + returningFromAchievements: false, }), actions: {