Skip to content

Commit

Permalink
CSS animation instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Jul 4, 2024
1 parent c296afc commit ae98c19
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/lib/Loading.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,10 @@
export let inline = true;
export let text: string = 'Loading...';
let count = 1;
const Increments = 5;
onMount(() => {
const timer = setInterval(() => {
count = (count + 1) % Increments;
}, 50);
return () => {
clearInterval(timer);
};
});
</script>

<div class:inline>
{text} <span class="dots" style:transform="rotate({360 * (count / Increments)}deg)">{Logo}</span>
{text} <span class="dots">{Logo}</span>
</div>

<style>
Expand All @@ -41,5 +29,15 @@
display: inline-block;
text-align: center;
transform-origin: center;
animation: spin 1s infinite linear;
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
</style>

0 comments on commit ae98c19

Please sign in to comment.