Skip to content

Commit 11da642

Browse files
committed
add: scroll indicator
1 parent c9cd51e commit 11da642

1 file changed

Lines changed: 61 additions & 1 deletion

File tree

src/App.svelte

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,71 @@
11
<script lang="ts">
22
import MainBird from "./lib/components/MainBird.svelte";
33
import Clock from "./lib/components/Clock.svelte";
4+
5+
import { theme } from "./lib/state/theme.svelte";
6+
import { onMount } from "svelte";
7+
8+
let scrollIndicator: SVGElement;
9+
10+
let textColour = $derived(
11+
theme.isDark
12+
? "oklch(0.9644 0.0282 74.31)"
13+
: "oklch(0.2316 0.0373 288.04)",
14+
);
15+
16+
function removeScrollIndicator() {
17+
scrollIndicator.classList.remove("animate-bounce");
18+
scrollIndicator.classList.add("slide-down")
19+
window.removeEventListener("scroll", removeScrollIndicator);
20+
}
21+
22+
onMount(() => {
23+
window.addEventListener("scroll", removeScrollIndicator);
24+
});
425
</script>
526

627
<header class="fixed flex flex-row bg-transparent"></header>
728
<main class="flex flex-col justify-center items-center">
829
<Clock />
930
<MainBird />
10-
<h1 class="text-4xl text-center mt-5">hi there</h1>
31+
<h1 class="text-4xl text-center mt-5">
32+
hi, i'm jackson,<br />a software developer
33+
</h1>
34+
35+
<div class="h-500">content</div>
1136
</main>
37+
<div class="fixed bottom-0 w-full flex justify-center pb-1">
38+
<svg
39+
bind:this={scrollIndicator}
40+
width="60"
41+
height="60"
42+
class="animate-bounce"
43+
>
44+
<path
45+
d="M15 15 L30 30 L45 15"
46+
stroke={textColour}
47+
stroke-width="2"
48+
fill="none"
49+
/>
50+
</svg>
51+
</div>
52+
53+
<style>
54+
:global {
55+
.slide-down {
56+
animation-duration: 250ms;
57+
animation-timing-function: ease-in-out;
58+
animation-fill-mode: forwards;
59+
animation-name: slide-down;
60+
}
61+
62+
@keyframes slide-down {
63+
from {
64+
transform: translateY(0);
65+
}
66+
to {
67+
transform: translateY(50px);
68+
}
69+
}
70+
}
71+
</style>

0 commit comments

Comments
 (0)