More drake
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 28s

This commit is contained in:
2026-03-17 23:30:20 +01:00
parent 95d095cbe4
commit c2d0e0f93a
15 changed files with 26 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
<template> <template>
<img ref="sprite" <img ref="sprite" v-show="loaded"
class="sprite pixelated" class="sprite pixelated"
:src="frame_paths[0]" :src="frame_paths[0]"
:width="props.width"> :width="props.width">
@@ -20,6 +20,7 @@ const props = defineProps<{
}>(); }>();
const sprite = ref(null); const sprite = ref(null);
const loaded = ref(false);
let frame_paths = []; let frame_paths = [];
for(let i = 1; i <= parseInt(props.frames); i++){ for(let i = 1; i <= parseInt(props.frames); i++){
@@ -29,15 +30,34 @@ for(let i = 1; i <= parseInt(props.frames); i++){
let current = 0; let current = 0;
const fps = props.fps ? parseInt(props.fps) : 4; const fps = props.fps ? parseInt(props.fps) : 4;
function preloadImages(imageArray) {
return Promise.all(
imageArray.map(src => {
return new Promise((resolve, reject) => {
const img = new Image();
img.src = src;
img.onload = resolve;
img.onerror = reject;
});
})
);
}
onMounted(() => { onMounted(() => {
sprite.value.style.top = props.top; sprite.value.style.top = props.top;
sprite.value.style.left = props.left; sprite.value.style.left = props.left;
sprite.value.style.bottom = props.bottom; sprite.value.style.bottom = props.bottom;
sprite.value.style.right = props.right; sprite.value.style.right = props.right;
loaded.value = true;
preloadImages(frame_paths).then(() => {
setInterval(() => { setInterval(() => {
current = (current + 1) % frame_paths.length; current = (current + 1) % frame_paths.length;
sprite.value.src = frame_paths[current]; sprite.value.src = frame_paths[current];
}, 1000 / fps); }, 1000 / fps);
});
}); });
</script> </script>

View File

@@ -17,7 +17,7 @@ onMounted(async () => {
<h1>ARANROIG.COM</h1> <h1>ARANROIG.COM</h1>
<Container> <Container>
<Sprite path="/sprites/alfadir/" frames="1" fps="1" top="-369px" right="-80px" width="800"></Sprite> <Sprite path="/sprites/alfadir/" frames="13" fps="6" top="-416px" right="-180px" width="900"></Sprite>
<p>Hi, I'm Aran! <p>Hi, I'm Aran!
<br>Welcome to my website! It is still under intense development, so I recommend to come back later! <br>Welcome to my website! It is still under intense development, so I recommend to come back later!
</p> </p>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB