Skip to content

Commit 9265e63

Browse files
committed
feat: improved performance of globe
1 parent 9046d47 commit 9265e63

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "module",
44
"version": "0.0.1",
55
"scripts": {
6-
"dev": "astro dev",
6+
"dev": "astro dev --port 3000 --host",
77
"clean": "rm -rf dist",
88
"start": "astro dev",
99
"build": "npm run clean && astro check && astro build",
@@ -38,4 +38,4 @@
3838
"devDependencies": {
3939
"@tailwindcss/typography": "^0.5.14"
4040
}
41-
}
41+
}

src/components/Globe.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ export function Globe() {
3232
markers: [ { location: [37.7595, -122.4367], size: Math.random() * (maxMarkerSize - minMarkerSize) + minMarkerSize }, { location: [40.7128, -74.006], size: Math.random() * (maxMarkerSize - minMarkerSize) + minMarkerSize }, { location: [52.520008, 13.404954], size: Math.random() * (maxMarkerSize - minMarkerSize) + minMarkerSize }, { location: [51.507351, -0.127758], size: Math.random() * (maxMarkerSize - minMarkerSize) + minMarkerSize }, { location: [35.689487, 139.691711], size: Math.random() * (maxMarkerSize - minMarkerSize) + minMarkerSize }, { location: [22.396427, 114.109497], size: Math.random() * (maxMarkerSize - minMarkerSize) + minMarkerSize }, { location: [30.047503, 31.233702], size: Math.random() * (maxMarkerSize - minMarkerSize) + minMarkerSize }, { location: [-33.86882, 151.20929], size: Math.random() * (maxMarkerSize - minMarkerSize) + minMarkerSize }, { location: [-9.746956, -44.261249], size: Math.random() * (maxMarkerSize - minMarkerSize) + minMarkerSize }, ],
3333
onRender: (state) => {
3434
state.phi = phi;
35-
phi += 0.0005;
35+
// phi += 0.0001;
3636
}
3737
});
3838

39+
// The animation is heavy, so we stop it after first render
40+
setTimeout(() => {
41+
globe.toggle(false);
42+
})
3943
return () => {
4044
globe.destroy();
4145
};

src/sections/Hero.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Anchor from "../components/Anchor.astro";
1515
Rubén Buzón
1616
</h1>
1717
<p
18-
class="text-4xl font-bold tracking-tight sm:text-5xl md:text-7xl pb-1 mt-3 bg-gradient-to-b from-50% to-100% from-white/50 to-gray-400/50 text-transparent bg-clip-text [text-shadow:_0_1px_5px_rgb(0_0_0_/_20%)]"
18+
class="text-4xl font-bold tracking-tight sm:text-5xl md:text-7xl pb-3 mt-3 bg-gradient-to-b from-50% to-100% from-white/50 to-gray-400/50 text-transparent bg-clip-text [text-shadow:_0_1px_5px_rgb(0_0_0_/_20%)]"
1919
>
2020
Full-Stack Engineer
2121
</p>

src/sections/Jobs.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import Separator from "../components/Separator.astro";
3333
<div
3434
class="absolute aspect-square w-[100%] -bottom-0 transform translate-y-1/2"
3535
>
36-
<Globe client:only />
36+
<Globe client:visible />
3737
</div>
3838
</div>
3939
<Section id="jobs" class="relative py-24 min-h-[90vh] flex flex-col">

0 commit comments

Comments
 (0)