aboutsummaryrefslogtreecommitdiff
path: root/src/lib/components/background.svelte
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2022-07-05 19:11:31 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2022-07-05 19:11:31 +0200
commit3717f7fbf9ec110b51fe002cdced5d73ebd6136b (patch)
tree6caa301bddd630dddfcc524c33c8d35d78baa05d /src/lib/components/background.svelte
parentf106543fe9cf1def42f2af9f011acf0c83ddd411 (diff)
Move things to components
Diffstat (limited to 'src/lib/components/background.svelte')
-rw-r--r--src/lib/components/background.svelte35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/lib/components/background.svelte b/src/lib/components/background.svelte
new file mode 100644
index 0000000..7664939
--- /dev/null
+++ b/src/lib/components/background.svelte
@@ -0,0 +1,35 @@
+<script>
+ import { browser } from '$app/env';
+
+ export let x;
+ export let y;
+
+ const kDotSize = 32;
+
+ $: {
+ if (browser) {
+ document.documentElement.style.setProperty('--dot-size', kDotSize + 'px');
+ document.documentElement.style.setProperty('--dot-x', kDotSize - x % kDotSize + 'px');
+ document.documentElement.style.setProperty('--dot-y', kDotSize - y % kDotSize + 'px');
+ }
+ }
+</script>
+
+<div class="background"></div>
+
+<style>
+ .background {
+ position: fixed;
+ top: 0;
+ bottom: 0;
+ user-select: none;
+ pointer-events: none;
+ background: radial-gradient(#aaa, #aaa 1px, #fff 1px, #fff var(--dot-size));
+ background-size: var(--dot-size) var(--dot-size);
+ background-position: var(--dot-x) var(--dot-y);
+ padding: 0;
+ margin: 0;
+ width: 100vw;
+ height: 100vh;
+ }
+</style>