feat: use useImages composable instead of <img> + useTemplateRef

This commit is contained in:
2025-11-18 21:12:00 +01:00
parent 6e510890ec
commit 694b64f0dd
18 changed files with 187 additions and 278 deletions

View File

@@ -1,21 +1,17 @@
<script setup lang="ts">
import BACKGROUND_IMAGE from "/assets/images/home/bottom-screen/background.png";
const store = useHomeStore();
const app = useAppStore();
const backgroundImage = useTemplateRef("backgroundImage");
const [backgroundImage] = useImages(BACKGROUND_IMAGE);
useRender((ctx) => {
if (!backgroundImage.value) return;
ctx.globalAlpha = app.booted ? 1 : store.intro.stage1Opacity;
ctx.drawImage(backgroundImage.value, 0, 0);
ctx.drawImage(backgroundImage!, 0, 0);
});
defineOptions({
render: () => null,
});
</script>
<template>
<img
ref="backgroundImage"
src="/assets/images/home/bottom-screen/background.png"
hidden
/>
</template>