Skip to content

Commit a5478cc

Browse files
committed
Improved starfield animation with skybox
1 parent c92d93c commit a5478cc

File tree

3 files changed

+394
-100
lines changed

3 files changed

+394
-100
lines changed

public/hiptyc_2020_8k.webp

3.49 MB
Loading

src/App.jsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { BrowserRouter, Route, Routes, useLocation } from 'react-router-dom';
2+
import { useState } from 'react';
23
import Header from './components/Header';
34
import Home from './pages/Home';
45
import Research from './pages/Research';
@@ -16,11 +17,26 @@ function App() {
1617
function AppContent() {
1718
const location = useLocation();
1819
const isSpacePage = location.pathname === '/space';
20+
const [uiVisible, setUiVisible] = useState(false);
21+
22+
// Handle skybox loaded - trigger UI fade in
23+
const handleSkyboxLoaded = () => {
24+
setTimeout(() => {
25+
setUiVisible(true);
26+
}, 500);
27+
};
1928

2029
return (
2130
<>
22-
<Starfield />
23-
<div style={{ position: 'relative', zIndex: 1 }}>
31+
<Starfield onSkyboxLoaded={handleSkyboxLoaded} uiVisible={uiVisible} />
32+
<div
33+
style={{
34+
position: 'relative',
35+
zIndex: 1,
36+
opacity: uiVisible ? 1 : 0,
37+
transition: 'opacity 0.5s ease-in-out'
38+
}}
39+
>
2440
{!isSpacePage && <Header />}
2541
<main>
2642
<Routes>

0 commit comments

Comments
 (0)