Chore : attempt to reduce loading times
release-tag / release-image (push) Successful in 51s

This commit is contained in:
2024-07-31 10:20:48 +02:00
parent cfbaeca52b
commit 0669619543
9 changed files with 569 additions and 593 deletions
+15 -13
View File
@@ -3,7 +3,6 @@ const settingsStore = useSettingsStore();
import gsap from "gsap";
import ShaderWorker from "~/assets/workers/ShaderWorker?worker";
import type { Game } from "~/netcode/interfaces";
const emit = defineEmits<{
ready: [];
@@ -25,6 +24,14 @@ const props = withDefaults(defineProps<Props>(), {
const _colorStart = reactive([0, 0.3, 0]);
const _colorEnd = reactive([0, 1, 0]);
if (props.isTurn) {
Object.assign(_colorStart, [0, 0.3, 0]);
Object.assign(_colorEnd, [0, 1, 0]);
} else {
Object.assign(_colorStart, [0, 0.2, 0.3]);
Object.assign(_colorEnd, [0, 1, 1]);
}
function initShader() {
return new Promise<void>((resolve, reject) => {
if (!canvas.value) {
@@ -127,20 +134,20 @@ watch(
gsap.to(_colorStart, { duration: 0.5, 0: 0, 1: 0.2, 2: 0.3 });
gsap.to(_colorEnd, { duration: 0.5, 0: 0, 1: 1, 2: 1 });
}
},
{ immediate: true }
}
);
watch([_colorEnd, _colorStart], () => {
recolorShader();
});
onMounted(async () => {
onMounted(() => {
worker = new ShaderWorker();
recolorShader();
await initShader();
initShader().then(() => {
emit("ready");
});
window.addEventListener("resize", resizeShader, true);
emit("ready");
});
onUnmounted(() => {
@@ -150,13 +157,8 @@ onUnmounted(() => {
</script>
<template>
<canvas
ref="canvas"
id="background"
:class="{ pixelated: settingsStore.shaderPixelated }"
width="480"
height="270"
></canvas>
<canvas ref="canvas" id="background" :class="{ pixelated: settingsStore.shaderPixelated }" width="480"
height="270"></canvas>
</template>
<style scoped>
+1 -1
View File
@@ -214,7 +214,7 @@ function discardCardClick(card: Card) {
@discardCardClick="discardCardClick"
>
</CardsGrouped>
<br>
<!-- <div class="cards_container"> -->
<!-- HAND -->
<!-- <template v-if="isSelf">