[fix] minigame

This commit is contained in:
kwaroran
2023-12-19 18:26:24 +09:00
parent 3676b8136d
commit bb8d7506f3

View File

@@ -34,15 +34,17 @@
</h2>
{#if clicks >= 5}
<div class="bg-black w-full p-3 mt-4 mb-4 rounded-md max-w-2xl">
<div class="bg-black w-full p-3 mt-4 mb-4 rounded-md max-w-2xl" id="minigame-div">
<span class="font-semibold text-lg">Score: {score}</span><br>
<span class="font-semibold text-lg">Time: {time.toFixed(0)}</span>
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
<img src="./santa.png" alt="santa"
style:margin-left={iconAnimation + 'rem'}
style:margin-left={iconAnimation + 'px'}
class:grayscale={!miniGameStart}
on:click={async () => {
iconAnimation = Math.random() * 30
const miniGameDiv = document.getElementById('minigame-div')
const max = miniGameDiv.clientWidth - 70
iconAnimation = Math.random() * max
if(!miniGameStart){
if(time === 0){
time = 20