mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
573 B
39 lines
573 B
6 years ago
|
<script>
|
||
|
import { fade } from 'svelte/transition';
|
||
|
|
||
|
let visible = true;
|
||
|
|
||
|
function spin(node, { duration }) {
|
||
|
return {
|
||
|
duration,
|
||
1 year ago
|
css: (t) => ``
|
||
6 years ago
|
};
|
||
|
}
|
||
|
</script>
|
||
|
|
||
4 years ago
|
<label>
|
||
1 year ago
|
<input type="checkbox" bind:checked={visible} />
|
||
4 years ago
|
visible
|
||
|
</label>
|
||
|
|
||
|
{#if visible}
|
||
1 year ago
|
<div class="centered" in:spin={{ duration: 8000 }} out:fade>
|
||
4 years ago
|
<span>transitions!</span>
|
||
|
</div>
|
||
|
{/if}
|
||
|
|
||
6 years ago
|
<style>
|
||
|
.centered {
|
||
|
position: absolute;
|
||
|
left: 50%;
|
||
|
top: 50%;
|
||
1 year ago
|
transform: translate(-50%, -50%);
|
||
6 years ago
|
}
|
||
|
|
||
|
span {
|
||
|
position: absolute;
|
||
1 year ago
|
transform: translate(-50%, -50%);
|
||
6 years ago
|
font-size: 4em;
|
||
|
}
|
||
1 year ago
|
</style>
|