feat: render image in background

This commit is contained in:
2025-11-09 21:04:05 +01:00
parent 10b0e0a1e3
commit d2b8bbdcb6
6 changed files with 68 additions and 3 deletions

View File

@@ -1,8 +1,13 @@
<script lang="ts" setup>
const backgroundImage = useTemplateRef("backgroundImage");
useRender((ctx) => {
ctx.fillStyle = "green";
ctx.fillRect(0, 0, 100, 100);
if (!backgroundImage.value) return;
ctx.drawImage(backgroundImage.value, 0, 0);
});
</script>
<template></template>
<template>
<img ref="backgroundImage" src="/assets/background.png" hidden />
</template>