Skip to content

Commit 07efaec

Browse files
authored
Merge pull request #2 from xirf/dev
Feat: Responsive and Animation
2 parents 03a54b2 + 5b434dc commit 07efaec

File tree

10 files changed

+134
-85
lines changed

10 files changed

+134
-85
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"dependencies": {
1313
"@astrojs/svelte": "^3.1.0",
1414
"@astrojs/ts-plugin": "^1.0.10",
15+
"animejs": "^3.2.1",
1516
"astro": "^2.8.0",
1617
"svelte": "^4.0.5"
1718
},

pnpm-lock.yaml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/anime.js

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/BaseNavbar.astro

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
2-
<nav>
3-
<a href="#">Home</a>
4-
<a href="#">Posts</a>
5-
<a href="#">Contact</a>
6-
</nav>
1+
<header class="fixed top-0 left-0 w-full text-white z-999 p-4 flex items-center justify-between">
2+
<span class="text-xl font-black tracking-widest">
3+
<span class="i-charm-gamepad bg-white"></span> ANDKA
4+
</span>
5+
<a href="mailto:hy@andka.me" class="px-4 py-1 transition-all duration-500 ease-in hover:(text-black bg-green border-transparent) border-2 border-white rounded-xl">Contact</a>
6+
</header>

src/features/home/components/About.astro

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,47 @@
22
---
33

44
<section id="about" class="relative flex p-14 w-full h-screen gap-10 text-gray-300 items-center justify-center max-w-screen-2xl m-auto">
5-
<div class="grid grid-cols-2">
5+
<div class="grid grid-cols-1 gap-y-8 xl:grid-cols-2">
66
<div class="flex flex-col gap-y-4 cursor-default">
7-
<h1 class="leadin text-5xl tracking-wide leading-tight font-black">
7+
<h1 class="leadin text-4xl lg:text-5xl tracking-wide leading-tight font-black">
88
<span class="hover:(text-green) transition-all duration-500 ease-in-out">Andika</span> is here!
99
</h1>
10-
<p class="max-w-md leading-8 text-gray">
11-
<span class="hover:text-green transition-all duration-500 ease-in-out">Web Developer</span> / <span
12-
class="hover:text-yellow transition-all duration-500 ease-in-out">JS Enthusiast</span
13-
> / <span class="hover:text-pink transition-all duration-500 ease-in-out">Weeb</span>
10+
<p class="max-w-md leading-8 text-gray relative">
11+
<span class="x-subs inline-block">Web Developer</span>
12+
<span class="x-subs inline-block">/</span>
13+
<span class="x-subs inline-block">JS Enthusiast</span>
14+
<span class="x-subs inline-block">/</span>
15+
<span class="x-subs inline-block">Weeb</span>
1416
</p>
1517

16-
<div class="absolute left-2rem top-1/5 flex rotate-98deg">
18+
<div class="absolute left-2rem top-2em md:top-1/5 flex rotate-98deg -z-50">
1719
<div class="border-2rem border-transparent border-r-green-400"></div>
1820
<div class="border-2rem border-transparent border-l-green-500"></div>
1921
</div>
2022

21-
<div class="absolute right-2rem bottom-1/5 flex rotate-14deg">
23+
<div class="absolute right-2rem bottom-1/5 flex rotate-14deg -z-50">
2224
<div class="border-1rem border-transparent border-r-green-400"></div>
2325
<div class="border-1rem border-transparent border-l-green-500"></div>
2426
</div>
2527

26-
<div class="absolute w-full -bottom-3rem right-3/5 opacity-25 h-200px bg-dotted from-gray-300"></div>
28+
<div class="absolute w-full -bottom-3rem right-3/5 opacity-25 h-200px bg-dotted from-gray-300 -z-50"></div>
2729
</div>
28-
<div class="flex flex-col gap-4 text-gray-300">
29-
<p>I'm Andika Nur Pratama, a JavaScript enthusiast from East Java, Indonesia.</p>
30-
<p>
31-
I began my journey from 2019 in third class of my vacational school. Now i majoring in Computer Sience at <a
30+
<div class="flex flex-col gap-4 text-gray-300 relative">
31+
<p class="x-about inline-block">
32+
Hello, I'm Andika Nur Pratama from East Java, <span
33+
class="hover:(bg-gradient-to-t from-white-50% via-white via-50% to-red-500 to-50% text-black) will-move">Indonesia</span
34+
>.
35+
</p>
36+
<p class="x-about inline-block">
37+
My journey began in 2019 during vacational school, and now i majoring in Computer Sience at <a
3238
href="https://umpo.ac.id/"
3339
class="hover:text-green underline transition-all duration-500 ease-in-out">Muhammadiyah University of Ponorogo</a
34-
> and i had a lot of experience in there.
40+
>.
41+
</p>
42+
<p class="x-about inline-block">
43+
JavaScript is my primary language, but I'm also exploring PHP, Python, Rust, and C++. Beyond web development, I love tackling new
44+
challenges and expanding my knowledge.
3545
</p>
36-
<>
37-
I chose JavaScript as my main programming language because it's easy to learn and i can use it everywhere. but i also learn other
38-
programming language like PHP, Python, Rust, and C++.
39-
</>
4046
</div>
4147
</div>
4248
</section>

src/features/home/components/Hero.astro

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,21 @@
22
---
33

44
<section id="hero" class="relative flex p-14 w-full h-screen gap-10 bg-primary text-gray-300 items-center max-w-screen-2xl m-auto">
5-
<div class="max-w-xl flex flex-col gap-y-8" data-animation="up" data-delay="0">
6-
<h1 class="leadin text-6xl tracking-wide leading-tight font-black">Self Taught Web Developer</h1>
7-
<p class="max-w-md leading-8">
8-
Building the internet, resolving problems, developing rich user experiences and seamless experiences, and learning new things is what I
9-
do.
5+
<div class="max-w-xl flex flex-col gap-y-8">
6+
<h1 class="title-target relative text-4xl md:text-5xl xl:text-6xl tracking-wide leading-tight font-black">Self Taught Web Developer</h1>
7+
<p class="max-w-md leading-8 x-hero2">
8+
The main parts of what I do are building the internet, solving complicated problems, and always growing my knowledge.
109
</p>
11-
<a href="#about" class="group">
12-
<button
13-
class="bg-green-400 text-primary font-bold py-2 px-4 rounded-xl transition-all duration-500 ease-in-out hover:shadow-d shadow-green">
14-
About Me <span class="i-charm:chevron-right from-green group-hover:rotate-90deg transition-all duration-500 ease-in-out"></span>
15-
</button>
16-
</a>
17-
18-
<div data-move="down up" style="--duration: 400ms" data-delay="300" class="will-move absolute right-1/4 bottom-4rem flex rotate-14deg">
19-
<div class="border-4rem border-transparent border-r-green-400"></div>
20-
<div class="border-4rem border-transparent border-l-green-500"></div>
21-
</div>
22-
23-
<div class="absolute w-full top-1/3 -right-3/5 opacity-25 h-200px bg-dotted from-gray-300"></div>
10+
<button
11+
data-target="1"
12+
class="w-fit bg-green-400 text-primary font-bold py-2 px-4 rounded-xl transition-all duration-500 ease-in-out hover:shadow-d shadow-green">
13+
About Me <span class="i-charm:chevron-right from-green group-hover:rotate-90deg transition-all duration-500 ease-in-out"></span>
14+
</button>
2415
</div>
16+
<div class="absolute right-1/10 xl:right-1/4 bottom-1/12 xl:bottom-8rem flex rotate-14deg">
17+
<div class="border-2em xl:border-4rem border-transparent border-r-green-400"></div>
18+
<div class="border-2em xl:border-4rem border-transparent border-l-green-500"></div>
19+
</div>
20+
21+
<div class="absolute w-full top-1/6 xl:top-1/3 -left-3/5 md:left-unset md:-right-3/5 opacity-25 h-200px bg-dotted from-gray-300"></div>
2522
</section>

src/features/home/components/Skills.astro

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,42 @@ const techStack = [
99
{ name: "Uno CSS", className: "brightness-200% invert i-logo-unocss" },
1010
{ name: "Tailwind CSS", className: "brightness-200% i-logo-tailwindcss-icon" },
1111
{ name: "Fastify", className: "brightness-200% invert i-logo-fastify-icon" },
12-
{ name: "Postgresql", className: "i-logo-postgresql" },
12+
{ name: "Postgresql", className: "brightness-75% i-logo-postgresql" },
1313
{ name: "php", className: "i-logo-php" },
1414
];
1515
---
1616

1717
<section
1818
id="skills"
19-
class="relative flex items-center justify-center p-14 w-full h-screen gap-10 bg-primary text-gray-300 items-center max-w-screen-2xl m-auto">
20-
<div class="flex flex-col gap-y-8 text-center justify-center items-center">
21-
<h1 class="leadin text-6xl tracking-wide leading-tight font-black">Things I do</h1>
22-
<div class="flex flex-col gap-3">
23-
<p class="leading-8 max-w-4xl">
24-
While my primary playground is web development, my curiosity knows no bounds. <span class="text-red">Beyond coding</span>, I thrive on
25-
embracing fresh horizons and tackling exciting challenges. Learning is my compass, and I'm forever charting new territories.
19+
class="relative flex items-center justify-center p-14 w-full h-screen gap-10 text-gray-300 items-center max-w-screen-2xl m-auto">
20+
<div class="flex relative flex-col gap-y-8 text-center justify-center items-center">
21+
<h1 class="x-title inline-block text-4xl md:text-6xl tracking-wide leading-tight font-black">Things I do</h1>
22+
<div class=" flex flex-col gap-3">
23+
<p class="leading-8 max-w-4xl x-title inline-block">
24+
While my primary playground is web development, my curiosity knows no bounds. Aside from <span class="text-red">coding</span>, I enjoy broadening my experiences and taking on new challenges. Learning is my compass, and I'm always exploring new territory.
2625
</p>
27-
<p class="leading-8 max-w-4xl">
26+
<p class="leading-8 max-w-4xl x-title inline-block">
2827
Here are some of the things I do, and some of the things I'm <span class="text-green">learning</span>.
2928
</p>
3029
</div>
3130

32-
<div class="text-7xl my-8 flex max-w-3xl items-center justify-center grayscale brightness-200% gap-10 gap-y-12 flex-wrap color-inherit">
31+
<div class="text-4xl md:text-5xl xl:text-7xl relative my-8 flex max-w-3xl items-center justify-center grayscale brightness-200% gap-4 md:gap-10 gap-y-8 lg:gap-y-12 flex-wrap color-inherit">
3332
{
3433
techStack.map((tech, index) => (
35-
<div class="flex flex-col gap-4 opacity-75 hover:opacity-100 duration-300 transition-all">
34+
<div class="x-skill inline-block flex flex-col gap-2 lg:gap-4 opacity-75 text-center items-center justify-center">
3635
<div class={tech.className} />
3736
<span class="text-xs">{tech.name}</span>
3837
</div>
3938
))
4039
}
4140
</div>
4241

43-
<div data-delay="200" data-move="down up" style="--duration:500ms" class="absolute will-move right-0 top-2/6 flex rotate-14deg">
42+
<div
43+
class=" absolute right-0 top-2/6 flex rotate-14deg -z-50">
4444
<div class="border-1.5rem border-transparent border-r-green-400"></div>
4545
<div class="border-1.5rem border-transparent border-l-green-500"></div>
4646
</div>
4747

48-
<div class="absolute w-300px top-0 left-0 opacity-15 h-screen bg-dotted from-gray-300"></div>
48+
<div class="absolute w-300px top-0 -left-200px lg:left-0 opacity-15 h-screen bg-dotted from-gray-300 -z-50"></div>
4949
</div>
5050
</section>

src/features/home/index.astro

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,32 @@ import About from "./components/About.astro";
55
---
66

77
<div class="relative w-full h-screen overflow-hidden">
8-
<div id="fullpage" class="w-full relative transition-all duration-1000 ease-in-out">
8+
<div id="fullpage" class="w-full relative ease-in-out-quart">
99
<Hero />
1010
<About />
1111
<Skills />
1212
</div>
1313
</div>
1414

15+
<script src="/anime.js" is:inline>
16+
import anime from "public/anime";
17+
</script>
1518
<script is:inline>
1619
const fullpage = document.getElementById("fullpage");
1720
const sections = fullpage.querySelectorAll("section").length;
18-
let moveAbleElement = document.querySelectorAll("section");
21+
22+
const commonAnimationConfig = {
23+
translateY: [ 50, 0 ],
24+
opacity: [ 0, 1 ],
25+
easing: "easeOutCirc",
26+
duration: 1000,
27+
loop: false,
28+
};
1929

2030
let isAnimating = false;
2131
let activeSection = 0;
2232

2333
function onWheel(e) {
24-
e.preventDefault();
25-
2634
if (isAnimating || (activeSection <= 0 && e.deltaY < 0) || (activeSection >= sections - 1 && e.deltaY > 0)) return;
2735

2836
if (e.deltaY > 0) {
@@ -35,20 +43,19 @@ function onWheel(e) {
3543
}
3644

3745
function onTouchStart(e) {
38-
e.preventDefault();
3946
const touch = e.touches[ 0 ];
4047
touchStartY = touch.pageY;
4148

4249
document.addEventListener("touchmove", onTouchMove);
4350
}
4451

4552
function onTouchMove(e) {
46-
e.preventDefault();
4753
const touch = e.touches[ 0 ];
4854
const touchEndY = touch.pageY;
4955

5056
if (isAnimating || (activeSection <= 0 && touchEndY > touchStartY) || (activeSection >= sections - 1 && touchEndY < touchStartY)) return;
5157

58+
sectionBefore = activeSection;
5259
if (touchEndY > touchStartY) {
5360
activeSection -= 1;
5461
} else {
@@ -60,28 +67,47 @@ function onTouchMove(e) {
6067

6168
function scrollToSection(section) {
6269
if (isAnimating) return;
63-
70+
activeSection = section;
6471
isAnimating = true;
6572

6673
fullpage.style.transform = `translateY(-${section * 100}vh)`;
6774

68-
moveAbleElement.forEach((el, index) => {
69-
if (index === section) {
70-
el.classList.add("visible");
71-
} else {
72-
el.classList.remove("visible");
73-
}
74-
75-
if (index < section) {
76-
el.classList.add("up");
77-
el.classList.remove("down");
78-
} else if (index > section) {
79-
el.classList.add("down");
80-
el.classList.remove("up");
81-
} else {
82-
el.classList.remove("up");
83-
el.classList.remove("down");
84-
}
75+
const animeConfig = [];
76+
77+
if (activeSection === 0) {
78+
animeConfig.push({
79+
targets: ".x-hero",
80+
delay: anime.stagger(7, { start: 1000 }),
81+
...commonAnimationConfig,
82+
});
83+
} else if (activeSection === 1) {
84+
animeConfig.push({
85+
targets: ".x-subs",
86+
delay: anime.stagger(50, { start: 1000 }),
87+
...commonAnimationConfig,
88+
});
89+
90+
animeConfig.push({
91+
targets: ".x-about",
92+
delay: anime.stagger(150, { start: 500 }),
93+
...commonAnimationConfig,
94+
});
95+
} else if (activeSection === 2) {
96+
animeConfig.push({
97+
targets: ".x-skill",
98+
delay: anime.stagger(70, { start: 1000 }),
99+
...commonAnimationConfig,
100+
});
101+
102+
animeConfig.push({
103+
targets: ".x-title",
104+
delay: anime.stagger(200, { start: 500 }),
105+
...commonAnimationConfig,
106+
});
107+
}
108+
109+
animeConfig.forEach((config) => {
110+
anime(config);
85111
});
86112

87113
setTimeout(() => {
@@ -92,9 +118,14 @@ function scrollToSection(section) {
92118
document.addEventListener("wheel", onWheel);
93119
document.addEventListener("touchstart", onTouchStart);
94120
document.addEventListener("touchmove", onTouchMove);
121+
document.querySelectorAll("button").forEach((button) => {
122+
button.addEventListener("click", () => {
123+
scrollToSection(parseInt(button.dataset.target));
124+
});
125+
});
95126
</script>
96127
<style is:global>
97-
.will-move {
98-
transition: all var(--duration, 1s) ease-in;
128+
.ease-in-out-quart {
129+
transition: all 1200ms cubic-bezier(0.88, 0, 0.265, 1) 0s;
99130
}
100131
</style>

src/layouts/BaseLayout.astro

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
23
import BaseHead from "@/components/BaseHead.astro";
34
import Footer from "@/components/Footer.astro";
45
import BaseNavbar from "@/components/BaseNavbar.astro";
@@ -14,12 +15,10 @@ const { title } = Astro.props;
1415
<head>
1516
<meta charset="utf-8" />
1617
<meta name="viewport" content="width=device-width, initial-scale=1" />
17-
<link rel="stylesheet" href="/style/fullpage.min.css">
18-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js" defer></script>
1918
<BaseHead title={title} />
2019
</head>
2120
<body class="bg-primary h-screen font-sans overflow-x-hidden">
22-
<!-- <BaseNavbar /> -->
21+
<BaseNavbar />
2322
<slot />
2423
<!-- <Footer /> -->
2524
</body>

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "astro/tsconfigs/strict",
33
"compilerOptions": {
4-
"baseUrl": ".",
4+
"baseUrl": "./",
55
"paths": {
66
"@/*": [
77
"src/*"

0 commit comments

Comments
 (0)