feat(home): navigation and outro animation to settings

This commit is contained in:
2025-11-24 11:17:13 +01:00
parent 5b1839e75c
commit ab2c6f2cc3
9 changed files with 47 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

View File

@@ -2,6 +2,7 @@
import GameButton from "./GameButton.vue"; import GameButton from "./GameButton.vue";
import ContactButton from "./ContactButton.vue"; import ContactButton from "./ContactButton.vue";
import DownloadPlayButton from "./DownloadPlayButton.vue"; import DownloadPlayButton from "./DownloadPlayButton.vue";
import SettingsButton from "./SettingsButton.vue";
import Selector from "~/components/Common/ButtonSelector.vue"; import Selector from "~/components/Common/ButtonSelector.vue";
const store = useHomeStore(); const store = useHomeStore();
@@ -11,10 +12,13 @@ const { selectedButton, selectorPosition } = useButtonNavigation({
projects: [31, 23, 193, 49], projects: [31, 23, 193, 49],
contact: [31, 71, 97, 49], contact: [31, 71, 97, 49],
downloadPlay: [127, 71, 97, 49], downloadPlay: [127, 71, 97, 49],
settings: [112, 167, 31, 26],
}, },
initialButton: "projects", initialButton: "projects",
onButtonClick: (button) => { onButtonClick: (button) => {
store.animateOutro(`/${button}`); if (button === "downloadPlay") throw new Error("Not implemented");
store.animateOutro(button);
}, },
navigation: { navigation: {
projects: { projects: {
@@ -26,10 +30,15 @@ const { selectedButton, selectorPosition } = useButtonNavigation({
contact: { contact: {
up: "projects", up: "projects",
right: "downloadPlay", right: "downloadPlay",
down: "settings",
}, },
downloadPlay: { downloadPlay: {
up: "projects", up: "projects",
left: "contact", left: "contact",
down: "settings",
},
settings: {
up: "last",
}, },
}, },
}); });
@@ -63,6 +72,11 @@ const getOpacity = (button?: (typeof selectedButton)["value"]) => {
:y="72 + getButtonOffset('contact')" :y="72 + getButtonOffset('contact')"
:opacity="getOpacity('contact')" :opacity="getOpacity('contact')"
/> />
<SettingsButton
:x="117"
:y="170 + getButtonOffset('settings')"
:opacity="getOpacity('settings')"
/>
<Selector :rect="selectorPosition" :opacity="getOpacity()" /> <Selector :rect="selectorPosition" :opacity="getOpacity()" />
</template> </template>

View File

@@ -0,0 +1,20 @@
<script setup lang="ts">
import BUTTON_IMAGE from "/assets/images/home/bottom-screen/buttons/settings.webp";
const props = defineProps<{
x: number;
y: number;
opacity: number;
}>();
const [buttonImage] = useImages(BUTTON_IMAGE);
useRender((ctx) => {
ctx.globalAlpha = props.opacity;
ctx.drawImage(buttonImage!, props.x, props.y);
});
defineOptions({
render: () => null,
});
</script>

View File

@@ -32,7 +32,7 @@ useRender((ctx) => {
ctx.globalAlpha = store.isIntro ctx.globalAlpha = store.isIntro
? store.intro.stage1Opacity ? store.intro.stage1Opacity
: store.isOutro : store.isOutro && store.outro.animateTop
? store.outro.stage1Opacity ? store.outro.stage1Opacity
: 1; : 1;
ctx.drawImage(calendarImage!, CALENDAR_LEFT - 3, CALENDAR_TOP - 33); ctx.drawImage(calendarImage!, CALENDAR_LEFT - 3, CALENDAR_TOP - 33);
@@ -44,7 +44,7 @@ useRender((ctx) => {
ctx.globalAlpha = store.isIntro ctx.globalAlpha = store.isIntro
? store.intro.stage1Opacity ? store.intro.stage1Opacity
: store.isOutro : store.isOutro && store.outro.animateTop
? store.outro.stage2Opacity ? store.outro.stage2Opacity
: 1; : 1;
for (let col = 0; col < CALENDAR_ROWS + (extraRow ? 1 : 0); col += 1) { for (let col = 0; col < CALENDAR_ROWS + (extraRow ? 1 : 0); col += 1) {

View File

@@ -56,14 +56,14 @@ function drawLine(
useRender((ctx) => { useRender((ctx) => {
ctx.globalAlpha = store.isIntro ctx.globalAlpha = store.isIntro
? store.intro.stage1Opacity ? store.intro.stage1Opacity
: store.isOutro : store.isOutro && store.outro.animateTop
? store.outro.stage1Opacity ? store.outro.stage1Opacity
: 1; : 1;
ctx.drawImage(clockImage!, 13, 45); ctx.drawImage(clockImage!, 13, 45);
ctx.globalAlpha = store.isIntro ctx.globalAlpha = store.isIntro
? store.intro.stage1Opacity ? store.intro.stage1Opacity
: store.isOutro : store.isOutro && store.outro.animateTop
? store.outro.stage2Opacity ? store.outro.stage2Opacity
: 1; : 1;
const now = new Date(); const now = new Date();

View File

@@ -19,7 +19,8 @@ useRender((ctx) => {
ctx.translate(0, store.isIntro ? store.intro.statusBarY : 0); ctx.translate(0, store.isIntro ? store.intro.statusBarY : 0);
ctx.globalAlpha = store.isOutro ? store.outro.stage2Opacity : 1; ctx.globalAlpha =
store.isOutro && store.outro.animateTop ? store.outro.stage2Opacity : 1;
ctx.drawImage(statusBarImage!, 0, 0); ctx.drawImage(statusBarImage!, 0, 0);
ctx.fillStyle = "#ffffff"; ctx.fillStyle = "#ffffff";

View File

@@ -9,8 +9,9 @@ export const useHomeStore = defineStore("home", {
outro: { outro: {
buttonOffsetY: 0, buttonOffsetY: 0,
stage1Opacity: 0, stage1Opacity: 1,
stage2Opacity: 0, stage2Opacity: 1,
animateTop: false,
}, },
isIntro: true, isIntro: true,
@@ -54,8 +55,9 @@ export const useHomeStore = defineStore("home", {
); );
}, },
animateOutro(to?: string) { animateOutro(to: "contact" | "projects" | "settings") {
this.isOutro = true; this.isOutro = true;
this.outro.animateTop = to !== "settings";
const duration = 0.4; const duration = 0.4;
const delay = 0.08; const delay = 0.08;
@@ -74,7 +76,7 @@ export const useHomeStore = defineStore("home", {
ease: "none", ease: "none",
onComplete: () => { onComplete: () => {
this.isOutro = true; this.isOutro = true;
if (to) navigateTo(to); navigateTo(`/${to}`);
}, },
}, },
); );