<script setup lang="ts">
const store = useContactStore();

const homeBackgroundImage = useTemplateRef("homeBackgroundImage");
const contactBackgroundImage = useTemplateRef("contactBackgroundImage");

callOnce("contactIntro", store.animateIntro);

useRender((ctx) => {
  if (!homeBackgroundImage.value || !contactBackgroundImage.value) return;

  if (store.isIntro) {
    ctx.drawImage(homeBackgroundImage.value, 0, 0);
    ctx.globalAlpha = store.intro.stage2Opacity;
  }

  ctx.drawImage(contactBackgroundImage.value, 0, 0);
});
</script>

<template>
  <img
    ref="homeBackgroundImage"
    src="/assets/images/home/bottom-screen/background.png"
    hidden
  />
  <img
    ref="contactBackgroundImage"
    src="/assets/images/contact/bottom-screen/background.png"
    hidden
  />
</template>
