[fix] minigame
This commit is contained in:
@@ -34,15 +34,17 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
{#if clicks >= 5}
|
{#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">Score: {score}</span><br>
|
||||||
<span class="font-semibold text-lg">Time: {time.toFixed(0)}</span>
|
<span class="font-semibold text-lg">Time: {time.toFixed(0)}</span>
|
||||||
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
||||||
<img src="./santa.png" alt="santa"
|
<img src="./santa.png" alt="santa"
|
||||||
style:margin-left={iconAnimation + 'rem'}
|
style:margin-left={iconAnimation + 'px'}
|
||||||
class:grayscale={!miniGameStart}
|
class:grayscale={!miniGameStart}
|
||||||
on:click={async () => {
|
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(!miniGameStart){
|
||||||
if(time === 0){
|
if(time === 0){
|
||||||
time = 20
|
time = 20
|
||||||
|
|||||||
Reference in New Issue
Block a user