feat(home): don't fade from white if nds was already booted
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const store = useHomeStore();
|
const store = useHomeStore();
|
||||||
|
const app = useAppStore();
|
||||||
|
|
||||||
const backgroundImage = useTemplateRef("backgroundImage");
|
const backgroundImage = useTemplateRef("backgroundImage");
|
||||||
|
|
||||||
useRender((ctx) => {
|
useRender((ctx) => {
|
||||||
if (!backgroundImage.value) return;
|
if (!backgroundImage.value) return;
|
||||||
|
|
||||||
ctx.globalAlpha = store.intro.stage1Opacity;
|
ctx.globalAlpha = app.booted ? 1 : store.intro.stage1Opacity;
|
||||||
ctx.drawImage(backgroundImage.value, 0, 0);
|
ctx.drawImage(backgroundImage.value, 0, 0);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const store = useHomeStore();
|
const store = useHomeStore();
|
||||||
|
const app = useAppStore();
|
||||||
|
|
||||||
const backgroundImage = useTemplateRef("backgroundImage");
|
const backgroundImage = useTemplateRef("backgroundImage");
|
||||||
|
|
||||||
useRender((ctx) => {
|
useRender((ctx) => {
|
||||||
if (!backgroundImage.value) return;
|
if (!backgroundImage.value) return;
|
||||||
|
|
||||||
ctx.globalAlpha = store.intro.stage1Opacity;
|
ctx.globalAlpha = app.booted ? 1 : store.intro.stage1Opacity;
|
||||||
|
|
||||||
ctx.drawImage(backgroundImage.value, 0, 0);
|
ctx.drawImage(backgroundImage.value, 0, 0);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
5
app/stores/app.ts
Normal file
5
app/stores/app.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export const useAppStore = defineStore("app", {
|
||||||
|
state: () => ({
|
||||||
|
booted: false,
|
||||||
|
}),
|
||||||
|
});
|
||||||
@@ -19,6 +19,8 @@ export const useHomeStore = defineStore("home", {
|
|||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
animateIntro() {
|
animateIntro() {
|
||||||
|
const appStore = useAppStore();
|
||||||
|
|
||||||
this.isIntro = true;
|
this.isIntro = true;
|
||||||
|
|
||||||
const start = 0.5;
|
const start = 0.5;
|
||||||
@@ -35,6 +37,7 @@ export const useHomeStore = defineStore("home", {
|
|||||||
ease: "none",
|
ease: "none",
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this.isIntro = false;
|
this.isIntro = false;
|
||||||
|
if (!appStore.booted) appStore.booted = true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user