Skip to content

Commit 9f9dad0

Browse files
committed
feat: New alter ego image for standard image with custom made svelte effect
1 parent 4d75e32 commit 9f9dad0

10 files changed

Lines changed: 227 additions & 95 deletions

File tree

astro.config.mjs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,25 @@ import spotlightjs from "@spotlightjs/astro";
1414
export default defineConfig({
1515
vite: {
1616
plugins: [tailwindcss()],
17+
server: {
18+
watch: {
19+
ignored: [
20+
"api/**",
21+
"node_modules/**",
22+
"target/**",
23+
"high_performance/**",
24+
"devops/**",
25+
"dist/**"
26+
]
27+
}
28+
}
1729
},
1830
output: "static",
19-
integrations: [icon(), react(), svelte(), sentry(), spotlightjs()],
31+
integrations: [
32+
icon(),
33+
react(),
34+
svelte(),
35+
sentry(),
36+
spotlightjs()
37+
],
2038
});

pnpm-workspace.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
ignoredBuiltDependencies:
2+
- sharp
3+
14
onlyBuiltDependencies:
5+
- '@sentry/cli'
26
- core-js
37
- esbuild
48
- sharp
5-
ignoredBuiltDependencies:
6-
- sharp

src/assets/alter-ego.png

1.76 MB
Loading

src/components/About.astro

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import ferris from "@/assets/ferris.png";
33
import SpotlightCard from "./react/SpotlightCard";
44
import GlowingHeader from "./react/GlowingHeader";
55
import GlowingText from "./react/GlowingText";
6-
import { Image } from "astro:assets";
76
import photo from "@/assets/photo.jpg";
7+
import alterEgo from "@/assets/alter-ego.png";
88
import StarBorder from "./react/StarBorder";
99
import { Icon } from "astro-icon/components";
10+
import AlterEgo from "./svelte/AlterEgo.svelte";
11+
import DecryptedText from "./react/DecryptedText";
1012
1113
const infoLeft: Array<{ header: string; content: string }> = [
1214
{
@@ -83,19 +85,29 @@ const infoRight: Array<{ header: string; content: string }> = [
8385
client:only="react"
8486
className="flex flex-col justify-between aspect-9/16 p-0! w-75 bg-transparent backdrop-blur-2xl"
8587
>
86-
<div class={"max-h-[60%] overflow-hidden hover:alter-ego"}>
87-
<Image src={photo} alt="Photo" />
88-
</div>
88+
<AlterEgo
89+
client:only="svelte"
90+
alter={alterEgo.src}
91+
base={photo.src}
92+
/>
8993
<div class="flex flex-col my-5 px-5">
9094
<GlowingText client:only="react">
91-
<span class="text-xl font-bold">Short bio</span>
95+
<span class="text-xl font-bold select-none">Short bio</span>
9296
</GlowingText>
93-
<p class="text-sm text-justify cursor-default">
94-
I'm a cybersecurity enthusiast and Rust developer with a
95-
knack for solving complex problems.
97+
<p class="text-sm text-justify cursor-default select-none">
98+
<DecryptedText
99+
client:only="react"
100+
sequential={true}
101+
text={"I'm a cybersecurity enthusiast and Rust developer with a knack for solving complex problems."}
102+
animateOn="view"
103+
speed={50}
104+
maxIterations={3}
105+
/>
96106
</p>
97-
<div class="w-full flex justify-end items-end px-3 mt-5 mb-3 z-10 cursor-pointer">
98-
<a
107+
<div
108+
class="w-full flex justify-end items-end px-3 mt-5 mb-3 z-10 cursor-pointer"
109+
>
110+
<a
99111
target="_blank"
100112
href="https://paypal.me/etherbeing"
101113
class="w-full"

src/components/Hero.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import StarBorder from "./react/StarBorder";
44
import TextType from "./react/TextType";
55
---
66

7-
<section
8-
class="relative min-h-screen w-full flex justify-center items-center flex-col py-32 text-center select-none cursor-default"
7+
<section id="home"
8+
class="relative min-h-screen flex justify-center items-center flex-col py-32 text-center select-none cursor-default"
99
>
1010
<h1 class="z-10 text-5xl font-bold animate-fade-up">
1111
<TextType

src/components/react/Header.tsx

Lines changed: 84 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,34 @@ const navs: Array<{
88
label: string;
99
links: Array<{ label: string; href: string }>;
1010
}> = [
11-
{
12-
label: "Info",
13-
links: [
14-
{ label: "About", href: "#about" },
15-
{ label: "Core Skills", href: "#core-skills" },
16-
{ label: "Services", href: "#services" },
17-
{ label: "Projects", href: "#projects" },
18-
{ label: "Blog", href: "#blog" },
19-
{ label: "Contact", href: "#contact" },
20-
],
21-
},
22-
{
23-
label: "Projects",
24-
links: [
25-
{ label: "CVE Forge", href: "https://github.com/etherbeing/cveforge" },
26-
{
27-
label: "This Website",
28-
href: "https://github.com/etherbeing/etherbeing.github.io",
29-
},
30-
{ label: "Senjor", href: "https://github.com/etherbeing/senjor" },
31-
{ label: "Powerhouse", href: "https://github.com/etherbeing/powerhouse" },
32-
{ label: "TFProtocol", href: "https://github.com/etherbeing/tfprotocol" },
33-
],
34-
},
35-
];
11+
{
12+
label: "Info",
13+
links: [
14+
{ label: "About", href: "#about" },
15+
{ label: "Core Skills", href: "#core-skills" },
16+
{ label: "Services", href: "#services" },
17+
{ label: "Projects", href: "#projects" },
18+
{ label: "Blog", href: "#blog" },
19+
{ label: "Contact", href: "#contact" },
20+
],
21+
},
22+
{
23+
label: "Projects",
24+
links: [
25+
{ label: "CVE Forge", href: "https://github.com/etherbeing/cveforge" },
26+
{
27+
label: "This Website",
28+
href: "https://github.com/etherbeing/etherbeing.github.io",
29+
},
30+
{ label: "Senjor", href: "https://github.com/etherbeing/senjor" },
31+
{ label: "Powerhouse", href: "https://github.com/etherbeing/powerhouse" },
32+
{ label: "TFProtocol", href: "https://github.com/etherbeing/tfprotocol" },
33+
],
34+
},
35+
];
3636

3737
export default function Header() {
38-
const [isOpen, setIsOpen] = useState(false);
38+
const [isOpen, setIsOpen] = useState<boolean|undefined>();
3939

4040
return (
4141
<header className="z-20 fixed w-screen flex items-center justify-center mt-10">
@@ -48,65 +48,71 @@ export default function Header() {
4848
src={`https://github.com/${import.meta.env.PUBLIC_GITHUB_USER}.png`}
4949
/>
5050
</a>
51+
<h1 className="text-2xl font-bold my-0 py-0 cursor-default select-none">
52+
etherbeing
53+
</h1>
5154
<Hamburger
5255
size={20}
5356
label="Show options"
5457
toggled={isOpen}
5558
onToggle={setIsOpen}
5659
></Hamburger>
5760
</div>
58-
<nav
59-
style={{
60-
animationDelay: `${navs.length * 100}ms`,
61-
}}
62-
className={`w-full grid grid-cols-1 md:grid-cols-2 gap-3 overflow-hidden transition-all duration-300 h-0 ${isOpen ? "nav-expand" : "nav-collapse"}`}
63-
>
64-
{navs.map((nav, i) => (
65-
<SpotlightCard
66-
key={i}
67-
className={`mt-5 w-full flex flex-col gap-3 translate-y-100 opacity-0`}
68-
style={{
69-
animationDelay: `${i * 100 + 100}ms`,
70-
backgroundColor: oklchGradient(
71-
0,
72-
10,
73-
0.05,
74-
300,
75-
i,
76-
navs.length,
77-
),
78-
}}
79-
>
80-
<h3 className="text-lg font-bold cursor-default">{nav.label}</h3>
81-
<div className="flex flex-col gap-3">
82-
{nav.links.map((link, i) => (
83-
<a
84-
onClick={(e) => {
85-
e.preventDefault();
86-
e.stopPropagation();
87-
const hash = new URL(e.currentTarget.href).hash;
88-
let section = document.querySelector(hash);
89-
if (section) {
90-
section.scrollIntoView({
91-
behavior: "smooth",
92-
});
93-
} else {
94-
location.assign(`/${hash}`);
95-
}
96-
setIsOpen(false);
97-
}}
98-
key={i}
99-
href={link.href}
100-
className="text-sm inline-flex items-center"
101-
>
102-
<GoArrowUpRight className="mr-2" />
103-
{link.label}
104-
</a>
105-
))}
106-
</div>
107-
</SpotlightCard>
108-
))}
109-
</nav>
61+
{isOpen !== undefined ? (
62+
63+
<nav
64+
style={{
65+
animationDelay: `${navs.length * 100}ms`,
66+
}}
67+
className={`w-full grid grid-cols-1 md:grid-cols-2 gap-3 overflow-hidden transition-all duration-300 h-0 ${isOpen ? "nav-expand" : "nav-collapse"}`}
68+
>
69+
{navs.map((nav, i) => (
70+
<SpotlightCard
71+
key={i}
72+
className={`mt-5 w-full flex flex-col gap-3 translate-y-100 opacity-0`}
73+
style={{
74+
animationDelay: `${i * 100 + 100}ms`,
75+
backgroundColor: oklchGradient(
76+
0,
77+
10,
78+
0.05,
79+
300,
80+
i,
81+
navs.length,
82+
),
83+
}}
84+
>
85+
<h3 className="text-lg font-bold cursor-default">{nav.label}</h3>
86+
<div className="flex flex-col gap-3">
87+
{nav.links.map((link, i) => (
88+
<a
89+
onClick={(e) => {
90+
e.preventDefault();
91+
e.stopPropagation();
92+
const hash = new URL(e.currentTarget.href).hash;
93+
let section = document.querySelector(hash);
94+
if (section) {
95+
section.scrollIntoView({
96+
behavior: "smooth",
97+
});
98+
} else {
99+
location.assign(`/${hash}`);
100+
}
101+
setIsOpen(false);
102+
}}
103+
key={i}
104+
href={link.href}
105+
className="text-sm inline-flex items-center"
106+
>
107+
<GoArrowUpRight className="mr-2" />
108+
{link.label}
109+
</a>
110+
))}
111+
</div>
112+
</SpotlightCard>
113+
))}
114+
</nav>
115+
) : null}
110116
</SpotlightCard>
111117
</header>
112118
);
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<script lang="ts">
2+
import { init } from "@sentry/astro";
3+
import { time } from "motion/react";
4+
5+
const { alter, base }: { alter: string; base: string } = $props();
6+
let x: number = $state(100);
7+
let to: number = $state(100);
8+
const speed = 0.01;
9+
const acceleration = 1;
10+
$effect(() => {
11+
if (x !== to) {
12+
setTimeout(() => {
13+
const initial = x;
14+
if (x < to) {
15+
x += acceleration;
16+
} else if (x > to) {
17+
x -= acceleration;
18+
} else {
19+
return;
20+
}
21+
if (initial < to && x > to) {
22+
x = to;
23+
} else if (initial > to && x < to) {
24+
x = to;
25+
}
26+
}, speed);
27+
}
28+
});
29+
let ref = $state();
30+
</script>
31+
32+
<div
33+
role="img"
34+
bind:this={ref}
35+
class={"max-h-[60%] h-full w-full overflow-hidden relative -z-10 left-0 top-0"}
36+
onfocus={null}
37+
onmouseenter={(e) => {
38+
to = (e.offsetX * 100) / e.currentTarget.clientWidth;
39+
}}
40+
onmousemove={(e) => {
41+
to = (e.offsetX * 100) / e.currentTarget.clientWidth;
42+
}}
43+
onmouseleave={(e) => {
44+
to = (e.offsetX * 100) / e.currentTarget.clientWidth > 50?100:0;
45+
}}
46+
>
47+
<img
48+
alt={"base"}
49+
src={base}
50+
class="absolute left-0 top-0 min-h-full w-full"
51+
/>
52+
<img
53+
alt={"alter"}
54+
src={alter}
55+
class="absolute left-0 top-0 min-h-full w-full"
56+
style="mask-image: linear-gradient(to right, transparent 0%, transparent {x}%, black {x}%, black 100%)"
57+
/>
58+
</div>

src/pages/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ const apiUrl = import.meta.env.PUBLIC_API_URL;
2222
<BlogPost apiUrl={apiUrl} client:only="react" />
2323
<Contact />
2424
<Footer />
25-
</Layout>
25+
</Layout>

src/scripts/scrollTrap.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { gsap } from "gsap";
2+
import ScrollTrigger from "gsap/ScrollTrigger";
3+
4+
gsap.registerPlugin(ScrollTrigger);
5+
6+
export function initScrollManager(sections_ids: string[]) {
7+
sections_ids.map(id => document.getElementById(id)).forEach((section, i, array) => {
8+
9+
const next = array[i + 1]; // optional for end boundary
10+
11+
gsap.fromTo(
12+
section,
13+
{ scale: 0.6 }, // when not visible / before entering
14+
{
15+
scale: 1, // while centered in viewport
16+
ease: "none",
17+
scrollTrigger: {
18+
trigger: section,
19+
endTrigger: next || section, // last one falls back to itself
20+
scrub: true,
21+
start: "top 50%", // begins scaling when top touches bottom of screen
22+
end: "bottom top", // back to shrink when leaving
23+
// markers: true, // enable for debugging
24+
onUpdate: self => {
25+
// shrink back near exit
26+
const progress = self.progress;
27+
const scale = progress < 0.5
28+
? gsap.utils.interpolate(0.6, 1.2, progress * 2) // enter zoom
29+
: gsap.utils.interpolate(1.2, 0.6, (progress - 0.5) * 2); // exit shrink
30+
gsap.set(section, { scale });
31+
}
32+
}
33+
}
34+
);
35+
});
36+
}

start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ echo $! > $API_PID
5151
# Frontend server
5252
WEB_PID=$TMP_PIDS/web.pid
5353
cd $ROOT_DIRECTORY
54-
pnpm run dev &
54+
pnpm run dev --verbose &
5555
echo $! > $WEB_PID
5656

5757
echo "Services are now up and running, now waiting for them to die (NOTE that killing the frontend pid is enough to kill them all)"

0 commit comments

Comments
 (0)