Skip to content

Commit 6f3d0e3

Browse files
author
Abd Ash
committed
Add animation on the main containers
1 parent d23264a commit 6f3d0e3

2 files changed

Lines changed: 45 additions & 2 deletions

File tree

src/components/Loader.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
if (loader) {
2525
setTimeout(() => {
2626
loader.classList.add("loader-hidden");
27+
// Dispatch event for main content to animate in
28+
window.dispatchEvent(new CustomEvent("loader-complete"));
2729
setTimeout(() => {
2830
loader.style.display = "none";
2931
}, 3000); // 1.5s fade out

src/pages/index.astro

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import "../styles/experience.css";
1111

1212
<div class="dashboard">
1313
<!-- ═══ PROFILE SIDEBAR ═══ -->
14-
<aside class="profile-card glass-panel">
14+
<aside class="profile-card glass-panel" id="profile-card">
1515
<div class="profile-top">
1616
<img
1717
src="/logo.png"
@@ -153,7 +153,7 @@ import "../styles/experience.css";
153153
</aside>
154154

155155
<!-- ═══ CONTENT PANEL ═══ -->
156-
<main class="content-panel glass-panel">
156+
<main class="content-panel glass-panel" id="content-panel">
157157
<nav class="tab-bar" role="tablist">
158158
<button
159159
class="tab active"
@@ -657,6 +657,18 @@ import "../styles/experience.css";
657657

658658
// Initialize color CSS properties
659659
setActiveColor("about");
660+
661+
// ═══ ENTRANCE ANIMATIONS ═══
662+
window.addEventListener("loader-complete", () => {
663+
const profile = document.getElementById("profile-card");
664+
const content = document.getElementById("content-panel");
665+
666+
if (profile) profile.classList.add("loaded");
667+
668+
setTimeout(() => {
669+
if (content) content.classList.add("loaded");
670+
}, 200); // Slight delay for staggered effect
671+
});
660672
</script>
661673
</MainLayout>
662674

@@ -683,6 +695,27 @@ import "../styles/experience.css";
683695
}
684696

685697
/* ═══ PROFILE SIDEBAR ═══ */
698+
.profile-card {
699+
opacity: 0;
700+
transform: translateY(20px);
701+
transition: opacity 0.8s ease-out, transform 0.8s ease-out;
702+
}
703+
704+
.profile-card.loaded {
705+
opacity: 1;
706+
transform: translateY(0);
707+
}
708+
709+
.content-panel {
710+
opacity: 0;
711+
transform: translateY(20px);
712+
transition: opacity 0.8s ease-out, transform 0.8s ease-out;
713+
}
714+
715+
.content-panel.loaded {
716+
opacity: 1;
717+
transform: translateY(0);
718+
}
686719
.profile-card {
687720
display: flex;
688721
flex-direction: column;
@@ -1302,4 +1335,12 @@ import "../styles/experience.css";
13021335
padding: 14px;
13031336
}
13041337
}
1338+
/* Ensure visible on mobile if JS fails or loader is skipped (fallback) */
1339+
@media (prefers-reduced-motion: reduce) {
1340+
.profile-card,
1341+
.content-panel {
1342+
opacity: 1 !important;
1343+
transform: none !important;
1344+
}
1345+
}
13051346
</style>

0 commit comments

Comments
 (0)