feat(settings): animate transition to submenu (background and sliding)
This commit is contained in:
@@ -135,8 +135,6 @@ useKeyDown((key) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onRender((ctx) => {
|
onRender((ctx) => {
|
||||||
assets.images.home.topScreen.background.draw(ctx, 0, 0);
|
|
||||||
|
|
||||||
// slash divider
|
// slash divider
|
||||||
ctx.globalAlpha = animation.opacity;
|
ctx.globalAlpha = animation.opacity;
|
||||||
ctx.translate(0, animation.offsetY);
|
ctx.translate(0, animation.offsetY);
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import { SettingsBottomScreenNumberInput as NumberInput } from "#components";
|
|||||||
import { useIntervalFn } from "@vueuse/core";
|
import { useIntervalFn } from "@vueuse/core";
|
||||||
|
|
||||||
const store = useSettingsStore();
|
const store = useSettingsStore();
|
||||||
const { assets } = useAssets();
|
|
||||||
const { onRender } = useScreen();
|
|
||||||
|
|
||||||
const now = ref(new Date());
|
const now = ref(new Date());
|
||||||
|
|
||||||
@@ -53,10 +51,6 @@ const handleConfirm = async () => {
|
|||||||
store.closeSubMenu();
|
store.closeSubMenu();
|
||||||
};
|
};
|
||||||
|
|
||||||
onRender((ctx) => {
|
|
||||||
assets.images.home.topScreen.background.draw(ctx, 0, 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
defineOptions({ render: () => null });
|
defineOptions({ render: () => null });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = defineProps<{
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
}>();
|
opacity?: number;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const { onRender } = useScreen();
|
const { onRender } = useScreen();
|
||||||
|
|
||||||
@@ -10,6 +16,7 @@ const settingsStore = useSettingsStore();
|
|||||||
const menusContext = inject<{
|
const menusContext = inject<{
|
||||||
isSubmenuSelected: ComputedRef<boolean>;
|
isSubmenuSelected: ComputedRef<boolean>;
|
||||||
selectedSubmenuParent: ComputedRef<string | null>;
|
selectedSubmenuParent: ComputedRef<string | null>;
|
||||||
|
selectedSubmenuExtraOffsetY: ComputedRef<number>;
|
||||||
}>("menusContext")!;
|
}>("menusContext")!;
|
||||||
|
|
||||||
const { assets } = useAssets();
|
const { assets } = useAssets();
|
||||||
@@ -29,24 +36,33 @@ const isAnyOtherMenuOpen = computed(() => {
|
|||||||
|
|
||||||
const animation = useMenuAnimation("clock", isOpen);
|
const animation = useMenuAnimation("clock", isOpen);
|
||||||
|
|
||||||
|
const submenuExtraOffset = (submenu: string) =>
|
||||||
|
settingsStore.selectedButton === submenu
|
||||||
|
? menusContext.selectedSubmenuExtraOffsetY.value
|
||||||
|
: 0;
|
||||||
|
|
||||||
onRender((ctx) => {
|
onRender((ctx) => {
|
||||||
|
ctx.globalAlpha = props.opacity;
|
||||||
ctx.translate(props.x, props.y);
|
ctx.translate(props.x, props.y);
|
||||||
|
|
||||||
if (isOpen.value || animation.playing) {
|
if (isOpen.value || animation.playing) {
|
||||||
assets.images.settings.topScreen.clock.time.draw(
|
assets.images.settings.topScreen.clock.time.draw(
|
||||||
ctx,
|
ctx,
|
||||||
48 - animation.stage2Offset,
|
48 - animation.stage2Offset,
|
||||||
-48 + animation.stage1Offset,
|
-48 + animation.stage1Offset + submenuExtraOffset("clockTime"),
|
||||||
);
|
);
|
||||||
assets.images.settings.topScreen.clock.date.draw(
|
assets.images.settings.topScreen.clock.date.draw(
|
||||||
ctx,
|
ctx,
|
||||||
0,
|
0,
|
||||||
-96 + animation.stage2Offset + animation.stage1Offset,
|
-96 +
|
||||||
|
animation.stage2Offset +
|
||||||
|
animation.stage1Offset +
|
||||||
|
submenuExtraOffset("clockDate"),
|
||||||
);
|
);
|
||||||
assets.images.settings.topScreen.clock.achievements.draw(
|
assets.images.settings.topScreen.clock.achievements.draw(
|
||||||
ctx,
|
ctx,
|
||||||
0,
|
0,
|
||||||
-48 + animation.stage1Offset,
|
-48 + animation.stage1Offset + submenuExtraOffset("clockAchievements"),
|
||||||
);
|
);
|
||||||
|
|
||||||
assets.images.settings.topScreen.clock.clockActive.draw(ctx, 0, 0);
|
assets.images.settings.topScreen.clock.clockActive.draw(ctx, 0, 0);
|
||||||
|
|||||||
@@ -72,8 +72,6 @@ const handleConfirm = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onRender((ctx) => {
|
onRender((ctx) => {
|
||||||
assets.images.home.topScreen.background.draw(ctx, 0, 0);
|
|
||||||
|
|
||||||
ctx.globalAlpha = animation.opacity;
|
ctx.globalAlpha = animation.opacity;
|
||||||
ctx.translate(0, animation.offsetY);
|
ctx.translate(0, animation.offsetY);
|
||||||
assets.images.settings.bottomScreen.clock.timeColon.draw(ctx, 112, 63);
|
assets.images.settings.bottomScreen.clock.timeColon.draw(ctx, 112, 63);
|
||||||
|
|||||||
@@ -20,6 +20,16 @@ import Selector from "~/components/Common/ButtonSelector.vue";
|
|||||||
|
|
||||||
const app = useAppStore();
|
const app = useAppStore();
|
||||||
const settingsStore = useSettingsStore();
|
const settingsStore = useSettingsStore();
|
||||||
|
const { assets } = useAssets();
|
||||||
|
const { onRender } = useScreen();
|
||||||
|
|
||||||
|
onRender((ctx) => {
|
||||||
|
if (settingsStore.submenuBackground.opacity > 0) {
|
||||||
|
ctx.globalAlpha = settingsStore.submenuBackground.opacity;
|
||||||
|
ctx.translate(0, settingsStore.submenuBackground.offsetY);
|
||||||
|
assets.images.home.topScreen.background.draw(ctx, 0, 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (app.previousScreen === "home") {
|
if (app.previousScreen === "home") {
|
||||||
settingsStore.selectedButton = "options";
|
settingsStore.selectedButton = "options";
|
||||||
@@ -150,6 +160,7 @@ const { select, selected, selectorPosition } = useButtonNavigation({
|
|||||||
disabled: computed(
|
disabled: computed(
|
||||||
() =>
|
() =>
|
||||||
settingsStore.currentSubMenu !== null ||
|
settingsStore.currentSubMenu !== null ||
|
||||||
|
settingsStore.submenuTransition.opacity < 1 ||
|
||||||
settingsStore.isIntro ||
|
settingsStore.isIntro ||
|
||||||
settingsStore.isOutro ||
|
settingsStore.isOutro ||
|
||||||
settingsStore.animatingNotification,
|
settingsStore.animatingNotification,
|
||||||
@@ -165,9 +176,16 @@ const selectedSubmenuParent = computed(() =>
|
|||||||
isSubmenuSelected.value ? getParentMenu(selected.value) : null,
|
isSubmenuSelected.value ? getParentMenu(selected.value) : null,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const selectedSubmenuExtraOffsetY = computed(
|
||||||
|
() =>
|
||||||
|
settingsStore.submenuTransition.selectorOffsetY -
|
||||||
|
settingsStore.submenuTransition.offsetY,
|
||||||
|
);
|
||||||
|
|
||||||
provide("menusContext", {
|
provide("menusContext", {
|
||||||
isSubmenuSelected,
|
isSubmenuSelected,
|
||||||
selectedSubmenuParent,
|
selectedSubmenuParent,
|
||||||
|
selectedSubmenuExtraOffsetY,
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
@@ -231,8 +249,20 @@ const selectorXOffset = computed(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const selectorTransitionOffsetY = computed(() => {
|
||||||
|
if (isSubmenuSelected.value || selected.value === "touchScreen") {
|
||||||
|
return settingsStore.submenuTransition.selectorOffsetY;
|
||||||
|
}
|
||||||
|
return settingsStore.submenuTransition.offsetY;
|
||||||
|
});
|
||||||
|
|
||||||
const handleActivateB = () => {
|
const handleActivateB = () => {
|
||||||
if (settingsStore.isIntro || settingsStore.isOutro) return;
|
if (
|
||||||
|
settingsStore.isIntro ||
|
||||||
|
settingsStore.isOutro ||
|
||||||
|
settingsStore.submenuTransition.opacity < 1
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
|
||||||
if (isSubmenuSelected.value) {
|
if (isSubmenuSelected.value) {
|
||||||
select(getParentMenu(selected.value));
|
select(getParentMenu(selected.value));
|
||||||
@@ -251,27 +281,53 @@ const handleActivateB = () => {
|
|||||||
settingsStore.menuOffsets[2] +
|
settingsStore.menuOffsets[2] +
|
||||||
settingsStore.menuOffsets[3]
|
settingsStore.menuOffsets[3]
|
||||||
"
|
"
|
||||||
:y="121 + settingsStore.menuYOffset"
|
:y="
|
||||||
:opacity="1"
|
121 +
|
||||||
|
settingsStore.menuYOffset +
|
||||||
|
(selected === 'touchScreen'
|
||||||
|
? settingsStore.submenuTransition.selectorOffsetY
|
||||||
|
: settingsStore.submenuTransition.offsetY)
|
||||||
|
"
|
||||||
|
:opacity="settingsStore.submenuTransition.opacity"
|
||||||
/>
|
/>
|
||||||
<UserMenu
|
<UserMenu
|
||||||
:x="129 + settingsStore.menuOffsets[1] + settingsStore.menuOffsets[2]"
|
:x="129 + settingsStore.menuOffsets[1] + settingsStore.menuOffsets[2]"
|
||||||
:y="121 + settingsStore.menuYOffset"
|
:y="
|
||||||
|
121 +
|
||||||
|
settingsStore.menuYOffset +
|
||||||
|
settingsStore.submenuTransition.offsetY
|
||||||
|
"
|
||||||
|
:opacity="settingsStore.submenuTransition.opacity"
|
||||||
/>
|
/>
|
||||||
<ClockMenu
|
<ClockMenu
|
||||||
:x="81 + settingsStore.menuOffsets[1]"
|
:x="81 + settingsStore.menuOffsets[1]"
|
||||||
:y="121 + settingsStore.menuYOffset"
|
:y="
|
||||||
|
121 +
|
||||||
|
settingsStore.menuYOffset +
|
||||||
|
settingsStore.submenuTransition.offsetY
|
||||||
|
"
|
||||||
|
:opacity="settingsStore.submenuTransition.opacity"
|
||||||
|
/>
|
||||||
|
<OptionsMenu
|
||||||
|
:x="33"
|
||||||
|
:y="
|
||||||
|
121 +
|
||||||
|
settingsStore.menuYOffset +
|
||||||
|
settingsStore.submenuTransition.offsetY
|
||||||
|
"
|
||||||
|
:opacity="settingsStore.submenuTransition.opacity"
|
||||||
/>
|
/>
|
||||||
<OptionsMenu :x="33" :y="121 + settingsStore.menuYOffset" />
|
|
||||||
|
|
||||||
<Selector
|
<Selector
|
||||||
:rect="[
|
:rect="[
|
||||||
selectorPosition[0] + selectorXOffset,
|
selectorPosition[0] + selectorXOffset,
|
||||||
selectorPosition[1] + settingsStore.menuYOffset,
|
selectorPosition[1] +
|
||||||
|
settingsStore.menuYOffset +
|
||||||
|
selectorTransitionOffsetY,
|
||||||
selectorPosition[2],
|
selectorPosition[2],
|
||||||
selectorPosition[3],
|
selectorPosition[3],
|
||||||
]"
|
]"
|
||||||
:opacity="1"
|
:opacity="settingsStore.submenuTransition.opacity"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CommonButtons
|
<CommonButtons
|
||||||
|
|||||||
@@ -186,7 +186,6 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onRender((ctx) => {
|
onRender((ctx) => {
|
||||||
assets.images.home.topScreen.background.draw(ctx, 0, 0);
|
|
||||||
ctx.textBaseline = "top";
|
ctx.textBaseline = "top";
|
||||||
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = defineProps<{
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
}>();
|
opacity?: number;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const { onRender } = useScreen();
|
const { onRender } = useScreen();
|
||||||
|
|
||||||
@@ -10,6 +16,7 @@ const settingsStore = useSettingsStore();
|
|||||||
const menusContext = inject<{
|
const menusContext = inject<{
|
||||||
isSubmenuSelected: ComputedRef<boolean>;
|
isSubmenuSelected: ComputedRef<boolean>;
|
||||||
selectedSubmenuParent: ComputedRef<string | null>;
|
selectedSubmenuParent: ComputedRef<string | null>;
|
||||||
|
selectedSubmenuExtraOffsetY: ComputedRef<number>;
|
||||||
}>("menusContext")!;
|
}>("menusContext")!;
|
||||||
|
|
||||||
const { assets } = useAssets();
|
const { assets } = useAssets();
|
||||||
@@ -29,24 +36,33 @@ const isAnyOtherMenuOpen = computed(() => {
|
|||||||
|
|
||||||
const animation = useMenuAnimation("options", isOpen);
|
const animation = useMenuAnimation("options", isOpen);
|
||||||
|
|
||||||
|
const submenuExtraOffset = (submenu: string) =>
|
||||||
|
settingsStore.selectedButton === submenu
|
||||||
|
? menusContext.selectedSubmenuExtraOffsetY.value
|
||||||
|
: 0;
|
||||||
|
|
||||||
onRender((ctx) => {
|
onRender((ctx) => {
|
||||||
|
ctx.globalAlpha = props.opacity;
|
||||||
ctx.translate(props.x, props.y);
|
ctx.translate(props.x, props.y);
|
||||||
|
|
||||||
if (isOpen.value || animation.playing) {
|
if (isOpen.value || animation.playing) {
|
||||||
assets.images.settings.topScreen.options._2048.draw(
|
assets.images.settings.topScreen.options._2048.draw(
|
||||||
ctx,
|
ctx,
|
||||||
48 - animation.stage2Offset,
|
48 - animation.stage2Offset,
|
||||||
-48 + animation.stage1Offset,
|
-48 + animation.stage1Offset + submenuExtraOffset("options2048"),
|
||||||
);
|
);
|
||||||
assets.images.settings.topScreen.options.renderingMode.draw(
|
assets.images.settings.topScreen.options.renderingMode.draw(
|
||||||
ctx,
|
ctx,
|
||||||
0,
|
0,
|
||||||
-96 + animation.stage2Offset + animation.stage1Offset,
|
-96 +
|
||||||
|
animation.stage2Offset +
|
||||||
|
animation.stage1Offset +
|
||||||
|
submenuExtraOffset("optionsRenderingMode"),
|
||||||
);
|
);
|
||||||
assets.images.settings.topScreen.options.language.draw(
|
assets.images.settings.topScreen.options.language.draw(
|
||||||
ctx,
|
ctx,
|
||||||
0,
|
0,
|
||||||
-48 + animation.stage1Offset,
|
-48 + animation.stage1Offset + submenuExtraOffset("optionsLanguage"),
|
||||||
);
|
);
|
||||||
|
|
||||||
assets.images.settings.topScreen.options.optionsActive.draw(ctx, 0, 0);
|
assets.images.settings.topScreen.options.optionsActive.draw(ctx, 0, 0);
|
||||||
|
|||||||
@@ -120,8 +120,6 @@ const handleConfirm = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onRender((ctx) => {
|
onRender((ctx) => {
|
||||||
assets.images.home.topScreen.background.draw(ctx, 0, 0);
|
|
||||||
|
|
||||||
ctx.font = "10px NDS10";
|
ctx.font = "10px NDS10";
|
||||||
ctx.textBaseline = "top";
|
ctx.textBaseline = "top";
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = defineProps<{
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
}>();
|
opacity?: number;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const { onRender } = useScreen();
|
const { onRender } = useScreen();
|
||||||
|
|
||||||
@@ -26,6 +32,7 @@ const isAnyOtherMenuOpen = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onRender((ctx) => {
|
onRender((ctx) => {
|
||||||
|
ctx.globalAlpha = props.opacity;
|
||||||
if (isAnyOtherMenuOpen.value) {
|
if (isAnyOtherMenuOpen.value) {
|
||||||
assets.images.settings.topScreen.touchScreen.touchScreenDisabled.draw(
|
assets.images.settings.topScreen.touchScreen.touchScreenDisabled.draw(
|
||||||
ctx,
|
ctx,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ const achievements = useAchievementsStore();
|
|||||||
const confirmationModal = useConfirmationModal();
|
const confirmationModal = useConfirmationModal();
|
||||||
|
|
||||||
const { onRender, onClick } = useScreen();
|
const { onRender, onClick } = useScreen();
|
||||||
const { assets } = useAssets();
|
|
||||||
|
|
||||||
const BAR_HEIGHT = 24;
|
const BAR_HEIGHT = 24;
|
||||||
const MAX_RADIUS = 27;
|
const MAX_RADIUS = 27;
|
||||||
@@ -276,8 +275,6 @@ onClick((mx, my) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onRender((ctx) => {
|
onRender((ctx) => {
|
||||||
assets.images.home.topScreen.background.draw(ctx, 0, 0);
|
|
||||||
|
|
||||||
// update crosshair position in all modes except paused
|
// update crosshair position in all modes except paused
|
||||||
if (state.value !== "paused") {
|
if (state.value !== "paused") {
|
||||||
if (horizontalFirst) {
|
if (horizontalFirst) {
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = defineProps<{
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
}>();
|
opacity?: number;
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const { onRender } = useScreen();
|
const { onRender } = useScreen();
|
||||||
|
|
||||||
@@ -10,6 +16,7 @@ const settingsStore = useSettingsStore();
|
|||||||
const menusContext = inject<{
|
const menusContext = inject<{
|
||||||
isSubmenuSelected: ComputedRef<boolean>;
|
isSubmenuSelected: ComputedRef<boolean>;
|
||||||
selectedSubmenuParent: ComputedRef<string | null>;
|
selectedSubmenuParent: ComputedRef<string | null>;
|
||||||
|
selectedSubmenuExtraOffsetY: ComputedRef<number>;
|
||||||
}>("menusContext")!;
|
}>("menusContext")!;
|
||||||
|
|
||||||
const { assets } = useAssets();
|
const { assets } = useAssets();
|
||||||
@@ -29,29 +36,38 @@ const isAnyOtherMenuOpen = computed(() => {
|
|||||||
|
|
||||||
const animation = useMenuAnimation("user", isOpen);
|
const animation = useMenuAnimation("user", isOpen);
|
||||||
|
|
||||||
|
const submenuExtraOffset = (submenu: string) =>
|
||||||
|
settingsStore.selectedButton === submenu
|
||||||
|
? menusContext.selectedSubmenuExtraOffsetY.value
|
||||||
|
: 0;
|
||||||
|
|
||||||
onRender((ctx) => {
|
onRender((ctx) => {
|
||||||
|
ctx.globalAlpha = props.opacity;
|
||||||
ctx.translate(props.x, props.y);
|
ctx.translate(props.x, props.y);
|
||||||
|
|
||||||
if (isOpen.value || animation.playing) {
|
if (isOpen.value || animation.playing) {
|
||||||
assets.images.settings.topScreen.user.birthday.draw(
|
assets.images.settings.topScreen.user.birthday.draw(
|
||||||
ctx,
|
ctx,
|
||||||
-48 + animation.stage2Offset,
|
-48 + animation.stage2Offset,
|
||||||
-48 + animation.stage1Offset,
|
-48 + animation.stage1Offset + submenuExtraOffset("userBirthday"),
|
||||||
);
|
);
|
||||||
assets.images.settings.topScreen.user.snake.draw(
|
assets.images.settings.topScreen.user.snake.draw(
|
||||||
ctx,
|
ctx,
|
||||||
48 - animation.stage2Offset,
|
48 - animation.stage2Offset,
|
||||||
-48 + animation.stage1Offset,
|
-48 + animation.stage1Offset + submenuExtraOffset("userSnake"),
|
||||||
);
|
);
|
||||||
assets.images.settings.topScreen.user.color.draw(
|
assets.images.settings.topScreen.user.color.draw(
|
||||||
ctx,
|
ctx,
|
||||||
0,
|
0,
|
||||||
-96 + animation.stage2Offset + animation.stage1Offset,
|
-96 +
|
||||||
|
animation.stage2Offset +
|
||||||
|
animation.stage1Offset +
|
||||||
|
submenuExtraOffset("userColor"),
|
||||||
);
|
);
|
||||||
assets.images.settings.topScreen.user.userName.draw(
|
assets.images.settings.topScreen.user.userName.draw(
|
||||||
ctx,
|
ctx,
|
||||||
0,
|
0,
|
||||||
-48 + animation.stage1Offset,
|
-48 + animation.stage1Offset + submenuExtraOffset("userUserName"),
|
||||||
);
|
);
|
||||||
|
|
||||||
assets.images.settings.topScreen.user.userActive.draw(ctx, 0, 0);
|
assets.images.settings.topScreen.user.userActive.draw(ctx, 0, 0);
|
||||||
|
|||||||
@@ -38,6 +38,17 @@ export const useSettingsStore = defineStore("settings", {
|
|||||||
menuOffsets: [0, -48, -48, -48] as [number, number, number, number],
|
menuOffsets: [0, -48, -48, -48] as [number, number, number, number],
|
||||||
menuYOffset: 72,
|
menuYOffset: 72,
|
||||||
|
|
||||||
|
submenuTransition: {
|
||||||
|
offsetY: 0,
|
||||||
|
selectorOffsetY: 0,
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
|
||||||
|
submenuBackground: {
|
||||||
|
offsetY: 16,
|
||||||
|
opacity: 0,
|
||||||
|
},
|
||||||
|
|
||||||
animatingNotification: false,
|
animatingNotification: false,
|
||||||
|
|
||||||
isIntro: true,
|
isIntro: true,
|
||||||
@@ -51,7 +62,23 @@ export const useSettingsStore = defineStore("settings", {
|
|||||||
this.currentSubMenu = null;
|
this.currentSubMenu = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
openSubMenu(submenu: SettingsSubMenu) {
|
async openSubMenu(submenu: SettingsSubMenu) {
|
||||||
|
await gsap
|
||||||
|
.timeline()
|
||||||
|
.to(this.submenuTransition, {
|
||||||
|
offsetY: -48,
|
||||||
|
selectorOffsetY: -140,
|
||||||
|
opacity: 0,
|
||||||
|
duration: 0.25,
|
||||||
|
ease: "none",
|
||||||
|
})
|
||||||
|
.fromTo(
|
||||||
|
this.submenuBackground,
|
||||||
|
{ offsetY: 16, opacity: 0 },
|
||||||
|
{ offsetY: 0, opacity: 1, duration: 0.25, ease: "none" },
|
||||||
|
"+=0.05",
|
||||||
|
);
|
||||||
|
|
||||||
this.currentSubMenu = submenu;
|
this.currentSubMenu = submenu;
|
||||||
|
|
||||||
const achievements = useAchievementsStore();
|
const achievements = useAchievementsStore();
|
||||||
@@ -66,8 +93,32 @@ export const useSettingsStore = defineStore("settings", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
closeSubMenu() {
|
async closeSubMenu() {
|
||||||
this.currentSubMenu = null;
|
this.currentSubMenu = null;
|
||||||
|
|
||||||
|
await gsap
|
||||||
|
.timeline()
|
||||||
|
.fromTo(
|
||||||
|
this.submenuBackground,
|
||||||
|
{ offsetY: 0, opacity: 1 },
|
||||||
|
{ offsetY: 16, opacity: 0, duration: 0.25, ease: "none" },
|
||||||
|
)
|
||||||
|
.fromTo(
|
||||||
|
this.submenuTransition,
|
||||||
|
{
|
||||||
|
offsetY: -48,
|
||||||
|
selectorOffsetY: -140,
|
||||||
|
opacity: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
offsetY: 0,
|
||||||
|
selectorOffsetY: 0,
|
||||||
|
opacity: 1,
|
||||||
|
duration: 0.25,
|
||||||
|
ease: "none",
|
||||||
|
},
|
||||||
|
"+=0.05",
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
animateIntro() {
|
animateIntro() {
|
||||||
|
|||||||
Reference in New Issue
Block a user