Lazi loadin
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 1m1s

This commit is contained in:
2026-04-13 15:19:25 +02:00
parent 6953b20b2c
commit 482fbffece
5 changed files with 1151 additions and 62 deletions

View File

@@ -15,7 +15,24 @@ const displayedText = ref("");
let index = 0
let interval = null
const dragon_names = ["katlum", "solus"];
const sprite_names = dragon_names.map(name => `/sprites/${name}/${name}.gif`);
const 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(() => {
preloadImages(sprite_names);
if (hasAnimated.value) {
displayedText.value = fullText
return