<script>
import { onDestroy } from 'svelte';
const dots = ['#f0c49a', '#ff798b', '#945a8b'].map((color, i, { length }) => {
const cx = (i - Math.floor(length / 2)) * 10;
const cy = i % 2 === 0 ? 0 : -5;
return {
color,
cx,
cy
}
})
const rays = {
sun: 7,
moon: 3
};
const intervalDuration = 1.5;
let isDark;
let count = 0;
let direction = 1;
let interval = setInterval(() => {
count += direction;
if(count > dots.length - 1 || count < 0) {
direction *= -1;
isDark = !isDark;
}
}, intervalDuration * 1000)
onDestroy(() => {
clearInterval(interval)
})
</script>
<style>
:global(body) {