diff --git a/src/lib/components/PeopleList.svelte b/src/lib/components/PeopleList.svelte index b2347a6..186f14c 100644 --- a/src/lib/components/PeopleList.svelte +++ b/src/lib/components/PeopleList.svelte @@ -4,6 +4,7 @@ export let size = 'normal'; import SvelteMarkdown from 'svelte-markdown'; + import { animateText } from '$lib/helpers'; function getPerson(id) { return people.find((p) => p.id === id); diff --git a/src/lib/helpers.js b/src/lib/helpers.js new file mode 100644 index 0000000..4dddce6 --- /dev/null +++ b/src/lib/helpers.js @@ -0,0 +1,36 @@ +export function rand(length) { + let result = ''; + const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + const charactersLength = characters.length; + let counter = 0; + while (counter < length) { + result += characters.charAt(Math.floor(Math.random() * charactersLength)); + counter += 1; + } + return result; +} + +export function animateText (ev) { + if (!ev.target.getAttribute('data-text')) { + ev.target.setAttribute('data-text', ev.target.innerHTML) + } + if (ev.target.getAttribute('data-animate') === "1") { + return; + } + ev.target.setAttribute('data-animate', "1") + const orig = ev.target.getAttribute('data-text') + const steps = orig.length + + const random = rand(orig.length) + ev.target.innerHTML = random + + for (let i = 0; i <= steps; i++) { + setTimeout(() => { + ev.target.innerHTML = orig.substring(0, i) + rand(orig.length - i) + + if (i === steps) { + ev.target.setAttribute('data-animate', "0") + } + }, 50*i) + } +} \ No newline at end of file diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index e090bce..261805b 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -3,6 +3,8 @@ export let data; import SvelteMarkdown from 'svelte-markdown'; + import { animateText } from '$lib/helpers'; + import { onMount } from 'svelte'; let navbar = false; @@ -13,6 +15,11 @@ { title: 'Sponsors', url: '#sponsors' }, { title: 'Ticket', url: '#ticket', class: 'button' } ]; + + onMount(async () => { + setTimeout(() => animateText({ target: document.getElementById('master-title') }), 0) + }); +
@@ -25,10 +32,10 @@
-
+
{#each menu as mi} - + {/each}
@@ -47,8 +54,8 @@
-
- {data.config.shortname} +
+ {data.config.shortname.toUpperCase()}
{data.config.date} @ {data.config.venue}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 450c4f5..0a27e8c 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,6 +1,7 @@