2022-05-03 02:34:11 +00:00
|
|
|
<script>
|
2022-05-04 20:42:15 +00:00
|
|
|
import { fly } from 'svelte/transition';
|
|
|
|
|
import Star from '$lib/Star.svelte'
|
2022-05-03 02:34:11 +00:00
|
|
|
|
2022-05-04 20:42:15 +00:00
|
|
|
let isStar = false;
|
2022-05-04 19:40:27 +00:00
|
|
|
|
2022-05-04 20:42:15 +00:00
|
|
|
function hitButton() {
|
|
|
|
|
isStar = true;
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
isStar = false;
|
|
|
|
|
}, 40);
|
|
|
|
|
}
|
2022-05-03 02:34:11 +00:00
|
|
|
</script>
|
|
|
|
|
|
2022-05-04 19:46:41 +00:00
|
|
|
<header>
|
|
|
|
|
<h1>Star World</h1>
|
|
|
|
|
</header>
|
2022-05-03 02:34:11 +00:00
|
|
|
|
2022-05-04 20:42:15 +00:00
|
|
|
<div style:position="relative">
|
|
|
|
|
{#if isStar}
|
|
|
|
|
<div class="star" out:fly={{ opacity: 0, y: -100, duration: 3000 }}>
|
|
|
|
|
<Star />
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
<button on:click={hitButton}>Level Up</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
2022-05-03 02:34:11 +00:00
|
|
|
<style>
|
2022-05-04 19:46:41 +00:00
|
|
|
header {
|
|
|
|
|
display: flex;
|
|
|
|
|
font-family: Arial, Helvetica, sans-serif;
|
2022-05-04 20:42:15 +00:00
|
|
|
margin-bottom: 60px;
|
2022-05-04 19:46:41 +00:00
|
|
|
}
|
|
|
|
|
|
2022-05-04 20:42:15 +00:00
|
|
|
.star {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: -30px;
|
|
|
|
|
z-index: -1;
|
2022-05-03 02:34:11 +00:00
|
|
|
}
|
|
|
|
|
</style>
|