feat(assets): new assets loading system (currently only for images)
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user