feat: require click on the loading screen, and make intro animation faster
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
const { onRender } = useScreen();
|
const { onRender } = useScreen();
|
||||||
const { assets } = useAssets();
|
const { assets } = useAssets();
|
||||||
const store = useIntroStore();
|
const store = useIntroStore();
|
||||||
|
|
||||||
const frames = Object.keys(assets.images.intro.logoAnimated).sort();
|
const frames = Object.keys(assets.images.intro.logoAnimated).sort();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@@ -1,11 +1,22 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const app = useAppStore();
|
||||||
|
const { isReady } = useAssets();
|
||||||
|
const { t } = useI18n();
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="fixed inset-0 bg-[#181818] flex items-center justify-center">
|
<div
|
||||||
|
class="fixed inset-0 bg-[#181818] flex flex-col items-center justify-center gap-4"
|
||||||
|
:class="{ 'cursor-pointer': isReady }"
|
||||||
|
@click="isReady && (app.userHasInteracted = true)"
|
||||||
|
>
|
||||||
<svg
|
<svg
|
||||||
viewBox="0 0 512 512"
|
viewBox="0 0 512 512"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
class="size-20 animate-pulse"
|
class="size-20 transition-[fill] duration-500 animate-pulse"
|
||||||
|
:style="{ fill: isReady ? '#888888' : '#2a2a2a' }"
|
||||||
>
|
>
|
||||||
<g fill="#2a2a2a">
|
<g>
|
||||||
<path
|
<path
|
||||||
d="M488,32c0-17.645-14.355-32-32-32H56C38.355,0,24,14.355,24,32v215c0,0.113,0.012,0.223,0.017,0.334
|
d="M488,32c0-17.645-14.355-32-32-32H56C38.355,0,24,14.355,24,32v215c0,0.113,0.012,0.223,0.017,0.334
|
||||||
C24.011,247.556,24,247.777,24,248c0,7.331,3.307,13.9,8.504,18.306C27.23,272.013,24,279.635,24,288v192c0,17.645,14.355,32,32,32
|
C24.011,247.556,24,247.777,24,248c0,7.331,3.307,13.9,8.504,18.306C27.23,272.013,24,279.635,24,288v192c0,17.645,14.355,32,32,32
|
||||||
@@ -99,6 +110,13 @@
|
|||||||
/>
|
/>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
<span
|
||||||
|
class="select-none transition-colors duration-500 animate-pulse"
|
||||||
|
:style="{ color: isReady ? '#888888' : '#2a2a2a', fontFamily: 'NDS10' }"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
isReady ? t("loadingScreen.clickToStart") : t("loadingScreen.loading")
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -614,6 +614,10 @@ const handleTouchEnd = (event: TouchEvent) => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
app.ready = true;
|
app.ready = true;
|
||||||
|
|
||||||
|
if (app.userHasInteracted) {
|
||||||
|
animateIntro();
|
||||||
|
}
|
||||||
|
|
||||||
if (renderer) {
|
if (renderer) {
|
||||||
renderer.instance.domElement.addEventListener("mousedown", handleMouseDown);
|
renderer.instance.domElement.addEventListener("mousedown", handleMouseDown);
|
||||||
renderer.instance.domElement.addEventListener("click", handleClick);
|
renderer.instance.domElement.addEventListener("click", handleClick);
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ useKeyDown(async ({ key, repeated }) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<LoadingScreen v-if="!isReady" />
|
<LoadingScreen v-if="!isReady || !app.userHasInteracted" />
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<TresCanvas
|
<TresCanvas
|
||||||
v-if="app.settings.renderingMode === '3d'"
|
v-if="app.settings.renderingMode === '3d'"
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ export const useAppStore = defineStore("app", {
|
|||||||
return {
|
return {
|
||||||
ready: false,
|
ready: false,
|
||||||
booted: false,
|
booted: false,
|
||||||
|
userHasInteracted: false,
|
||||||
settings,
|
settings,
|
||||||
previousScreen: "home" as AppScreen,
|
previousScreen: "home" as AppScreen,
|
||||||
screen: "home" as AppScreen,
|
screen: "home" as AppScreen,
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ export const useIntroStore = defineStore("intro", {
|
|||||||
this.isIntro = true;
|
this.isIntro = true;
|
||||||
|
|
||||||
const { assets } = useAssets();
|
const { assets } = useAssets();
|
||||||
|
const app = useAppStore();
|
||||||
|
const delay = app.settings.renderingMode === "2d" ? 1 : 3;
|
||||||
const totalFrames = Object.keys(assets.images.intro.logoAnimated).length;
|
const totalFrames = Object.keys(assets.images.intro.logoAnimated).length;
|
||||||
const logoDuration = totalFrames / 25;
|
const logoDuration = totalFrames / 25;
|
||||||
|
|
||||||
@@ -37,7 +39,7 @@ export const useIntroStore = defineStore("intro", {
|
|||||||
duration: 0.1,
|
duration: 0.1,
|
||||||
ease: "none",
|
ease: "none",
|
||||||
},
|
},
|
||||||
4.1,
|
delay,
|
||||||
)
|
)
|
||||||
.to(
|
.to(
|
||||||
this.intro,
|
this.intro,
|
||||||
@@ -46,7 +48,7 @@ export const useIntroStore = defineStore("intro", {
|
|||||||
duration: logoDuration,
|
duration: logoDuration,
|
||||||
ease: "steps(" + (totalFrames - 1) + ")",
|
ease: "steps(" + (totalFrames - 1) + ")",
|
||||||
},
|
},
|
||||||
4.1,
|
delay,
|
||||||
)
|
)
|
||||||
.call(() => {
|
.call(() => {
|
||||||
const app = useAppStore();
|
const app = useAppStore();
|
||||||
|
|||||||
@@ -44,11 +44,9 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"title": "Settings",
|
"title": "Settings",
|
||||||
"description": "Change system settings here. Select\nthe settings you'd like to change.",
|
"description": "Change system settings here. Select\nthe settings you'd like to change.",
|
||||||
|
|
||||||
"options": {
|
"options": {
|
||||||
"title": "Options",
|
"title": "Options",
|
||||||
"description": "Change other settings.",
|
"description": "Change other settings.",
|
||||||
|
|
||||||
"renderingMode": {
|
"renderingMode": {
|
||||||
"title": "Rendering",
|
"title": "Rendering",
|
||||||
"description": "Change the app rendering mode\nbetween 2D and 3D.",
|
"description": "Change the app rendering mode\nbetween 2D and 3D.",
|
||||||
@@ -77,7 +75,6 @@
|
|||||||
"clock": {
|
"clock": {
|
||||||
"title": "Clock",
|
"title": "Clock",
|
||||||
"description": "Change date, time, and achievement\nsettings.",
|
"description": "Change date, time, and achievement\nsettings.",
|
||||||
|
|
||||||
"achievements": {
|
"achievements": {
|
||||||
"title": "Achievements",
|
"title": "Achievements",
|
||||||
"description": "Manage your achievements.",
|
"description": "Manage your achievements.",
|
||||||
@@ -87,7 +84,6 @@
|
|||||||
"obtained": "Obtained",
|
"obtained": "Obtained",
|
||||||
"total": "Total"
|
"total": "Total"
|
||||||
},
|
},
|
||||||
|
|
||||||
"date": {
|
"date": {
|
||||||
"title": "Date",
|
"title": "Date",
|
||||||
"description": "Today's date.",
|
"description": "Today's date.",
|
||||||
@@ -95,7 +91,6 @@
|
|||||||
"day": "Day",
|
"day": "Day",
|
||||||
"year": "Year"
|
"year": "Year"
|
||||||
},
|
},
|
||||||
|
|
||||||
"time": {
|
"time": {
|
||||||
"title": "Time",
|
"title": "Time",
|
||||||
"description": "Current time.",
|
"description": "Current time.",
|
||||||
@@ -106,7 +101,6 @@
|
|||||||
"user": {
|
"user": {
|
||||||
"title": "User",
|
"title": "User",
|
||||||
"description": "Enter user informations.",
|
"description": "Enter user informations.",
|
||||||
|
|
||||||
"color": {
|
"color": {
|
||||||
"title": "Color",
|
"title": "Color",
|
||||||
"description": "Select your favorite color.",
|
"description": "Select your favorite color.",
|
||||||
@@ -181,5 +175,9 @@
|
|||||||
"no": "no",
|
"no": "no",
|
||||||
"text": "Open {url}?"
|
"text": "Open {url}?"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"loadingScreen": {
|
||||||
|
"loading": "Loading...",
|
||||||
|
"clickToStart": "Click to start"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user