Skip to content

Commit 5a0ab32

Browse files
author
linuxjava7
committed
cool animations
1 parent eb9ce7c commit 5a0ab32

File tree

3 files changed

+63
-29
lines changed

3 files changed

+63
-29
lines changed

_includes/layouts/base.njk

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,33 @@
8989

9090
<!-- This page `{{ page.url }}` was built on {% currentBuildDate %} -->
9191
<script type="module" src="{% getBundleFileUrl "js" %}"></script>
92+
93+
<script>
94+
document.addEventListener("DOMContentLoaded", function () {
95+
const allElements = document.querySelectorAll(
96+
'main h1, main h2, main h3, main h4, main h5, main h6, main p, main li, main .card'
97+
);
98+
99+
let staggerIndex = 0;
100+
101+
allElements.forEach((el) => {
102+
if (el.classList.contains("card")) {
103+
el.classList.add("appear");
104+
el.style.animationDelay = `${staggerIndex * 150}ms`;
105+
el.style.animationDuration = "800ms";
106+
staggerIndex++;
107+
}
108+
else if (!el.closest('.card')) {
109+
el.classList.add("appear");
110+
el.style.animationDelay = `${staggerIndex * 150}ms`;
111+
el.style.animationDuration = "800ms";
112+
staggerIndex++;
113+
}
114+
});
115+
});
116+
</script>
117+
118+
119+
92120
</body>
93121
</html>

content/index.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const eleventyNavigation = {
66
};
77
---
88
<div class="container" id="intro">
9-
<h1>LinuxJava7</h1>
9+
<h1 style="animation-duration: 100ms;">LinuxJava7</h1>
1010
<p><strong>Hey, I'm LinuxJava7. </strong>I'm a hobbyist UX and UI designer, Linux desktop user since 2021, FOSS (Free and Open Source Software) enthusiast, and aspiring full-stack developer.</p>
1111
</div>
1212

css/index.css

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -613,8 +613,8 @@ a[href^="http"]:not(:has(.arrow)):not(:has(img)):not(:has(svg))::after {
613613
margin-right: 6px;
614614
vertical-align: middle;
615615
display: inline-block;
616-
width: 20px;
617-
height: 20px;
616+
width: 1rem;
617+
height: auto;
618618
fill: currentColor;
619619
}
620620

@@ -676,45 +676,31 @@ a[href^="http"]:not(:has(.arrow)):not(:has(img)):not(:has(svg))::after {
676676
flex-shrink: 0;
677677
}
678678

679-
/* View Switcher Narrow Specific */
680-
.view-switcher-narrow {
681-
width: 100%;
682-
height: 100%;
683-
align-content: center;
684-
align-items: stretch;
685-
margin: 1rem;
686-
}
687-
688-
.view-switcher-narrow a {
689-
flex-direction: column;
690-
gap: 0.05rem;
691-
font-size: 0.8rem;
692-
}
679+
/* View Switcher States */
693680

694-
.view-switcher-narrow svg {
695-
margin-top: 0.25rem;
696-
width: 1.2rem;
681+
.view-switcher a {
682+
transform: scale(100%);
697683
}
698684

699-
/* View Switcher States */
700685
.view-switcher a:hover,
701-
.view-switcher a:focus,
702-
.view-switcher-narrow a:hover,
703-
.view-switcher-narrow a:focus {
686+
.view-switcher a:focus {
704687
background-color: rgba(0, 0, 6, 0.03);
705688
color: var(--window-fg-color);
689+
transform: scale(102.5%);
690+
transition: transform 200ms var(--slickease);
691+
}
692+
.view-switcher a:active {
693+
transform: scale(97.5%);
694+
transition: transform 200ms var(--slickease);
706695
}
707696

708-
.view-switcher .current,
709-
.view-switcher-narrow .current {
697+
.view-switcher .current {
710698
background-color: rgba(0, 0, 6, 0.05);
711699
color: var(--view-switcher-accent);
712700
}
713701

714702
.view-switcher .current:hover,
715-
.view-switcher .current:focus,
716-
.view-switcher-narrow .current:hover,
717-
.view-switcher-narrow .current:focus {
703+
.view-switcher .current:focus {
718704
background-color: rgba(0, 0, 6, 0.08);
719705
color: var(--view-switcher-accent);
720706
}
@@ -873,3 +859,23 @@ footer {
873859
flex-direction: column;
874860
gap: 2rem;
875861
}
862+
863+
@keyframes appear {
864+
from {
865+
transform: translateY(16px);
866+
opacity: 0;
867+
}
868+
50% {
869+
transform: translateY(-2px);
870+
opacity: 100;
871+
}
872+
to {
873+
transform: translateY(0);
874+
opacity: 100;
875+
}
876+
}
877+
878+
.appear {
879+
opacity: 0;
880+
animation: appear ease forwards;
881+
}

0 commit comments

Comments
 (0)