feat(assets): new assets loading system (currently only for images)

This commit is contained in:
2025-12-17 12:28:48 +01:00
parent 05398d5252
commit b85899617b
106 changed files with 359 additions and 366 deletions

View File

@@ -1,6 +1,4 @@
<script setup lang="ts">
import CORNER_IMAGE from "/assets/images/home/bottom-screen/buttons/corner.webp";
const props = withDefaults(
defineProps<{
rect: [x: number, y: number, width: number, height: number];
@@ -11,7 +9,7 @@ const props = withDefaults(
},
);
const [cornerImage] = useImages(CORNER_IMAGE);
const { assets } = useAssets();
const ANIMATION_SPEED = 0.25;
@@ -45,21 +43,21 @@ useRender((ctx) => {
ctx.globalAlpha = props.opacity;
ctx.drawImage(cornerImage!, x, y);
ctx.drawImage(assets.home.bottomScreen.buttons.corner, x, y);
ctx.save();
ctx.scale(-1, 1);
ctx.drawImage(cornerImage!, -(x + w), y);
ctx.drawImage(assets.home.bottomScreen.buttons.corner, -(x + w), y);
ctx.restore();
ctx.save();
ctx.scale(1, -1);
ctx.drawImage(cornerImage!, x, -(y + h));
ctx.drawImage(assets.home.bottomScreen.buttons.corner, x, -(y + h));
ctx.restore();
ctx.save();
ctx.scale(-1, -1);
ctx.drawImage(cornerImage!, -(x + w), -(y + h));
ctx.drawImage(assets.home.bottomScreen.buttons.corner, -(x + w), -(y + h));
ctx.restore();
});