From 7638aff382799dddd12597702fe5c86b57e23702 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Wed, 8 May 2024 18:18:05 -0700
Subject: feat(NumberTicker): unused, but implemented

---
 src/lib/Layout/NumberTicker.svelte | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 src/lib/Layout/NumberTicker.svelte

(limited to 'src/lib/Layout/NumberTicker.svelte')

diff --git a/src/lib/Layout/NumberTicker.svelte b/src/lib/Layout/NumberTicker.svelte
new file mode 100644
index 00000000..1d09c3ef
--- /dev/null
+++ b/src/lib/Layout/NumberTicker.svelte
@@ -0,0 +1,36 @@
+<script>
+	import { tweened } from 'svelte/motion';
+	import { cubicOut } from 'svelte/easing';
+
+	export let start = 0;
+	export let end = 100;
+	export let duration = 2000;
+	export let delay = 0;
+
+	const count = tweened(start, {
+		duration: duration,
+		easing: cubicOut,
+		delay: delay
+	});
+
+	$: {
+		count.set(end);
+	}
+</script>
+
+<span class="counter" class:visible={$count !== start}>
+	{Math.round($count)}
+</span>
+
+<style lang="scss">
+	.counter {
+		$duration: 0.2s;
+
+		opacity: 0;
+		transition: opacity $duration ease-out, transform $duration ease-out;
+	}
+
+	.counter.visible {
+		opacity: 1;
+	}
+</style>
-- 
cgit v1.2.3

