Skip to content

Commit cd3bf5f

Browse files
committed
feat: update Aurora component color handling and adjust background properties for improved visual effect
1 parent 609a9bf commit cd3bf5f

File tree

3 files changed

+43
-9
lines changed

3 files changed

+43
-9
lines changed

app/layout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ export default function RootLayout({
8989
{/* Aurora Background */}
9090
<div className="fixed inset-0 -z-20 w-screen h-screen">
9191
<Aurora
92-
colorStops={["hsl(0 0% 12%)", "hsl(0 0% 40%)", "hsl(0 0% 95%)"]}
93-
blend={0.5}
94-
amplitude={1.0}
92+
colorStops={["rgb(0,0,0)", "rgb(0,0,0)", "rgb(0,0,0)"]}
93+
blend={0.4}
94+
amplitude={0.8}
9595
speed={0.5}
9696
/>
9797
</div>

components/sections/projects.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,17 @@ function ProjectCard({
186186
return (
187187
<motion.div
188188
className="relative rounded-xl border border-border bg-card/10 p-6 group"
189-
initial={{ opacity: 0, y: 50, rotateX: -15 }}
189+
initial={{
190+
opacity: 0,
191+
y: 50,
192+
rotateX: -15,
193+
boxShadow: "0 0px 0px rgba(0, 0, 0, 0)"
194+
}}
190195
whileInView={{
191196
opacity: 1,
192197
y: 0,
193-
rotateX: 0
198+
rotateX: 0,
199+
boxShadow: "0 0px 0px rgba(0, 0, 0, 0)"
194200
}}
195201
viewport={{ once: true, margin: "-50px" }}
196202
transition={{

components/ui/aurora.tsx

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,22 @@ export default function Aurora(props: AuroraProps) {
158158
delete geometry.attributes.uv;
159159
}
160160

161-
const colorStopsArray = colorStops.map(hex => {
162-
const c = new Color(hex);
161+
const colorStopsArray = colorStops.map(colorStr => {
162+
let c: Color;
163+
if (colorStr.startsWith('rgb(')) {
164+
// Parse rgb(r,g,b) format
165+
const rgbMatch = colorStr.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
166+
if (rgbMatch) {
167+
const r = parseInt(rgbMatch[1]) / 255;
168+
const g = parseInt(rgbMatch[2]) / 255;
169+
const b = parseInt(rgbMatch[3]) / 255;
170+
c = new Color(r, g, b);
171+
} else {
172+
c = new Color('#808080'); // fallback gray
173+
}
174+
} else {
175+
c = new Color(colorStr);
176+
}
163177
return [c.r, c.g, c.b];
164178
});
165179

@@ -187,8 +201,22 @@ export default function Aurora(props: AuroraProps) {
187201
program.uniforms.uAmplitude.value = propsRef.current.amplitude ?? 1.0;
188202
program.uniforms.uBlend.value = propsRef.current.blend ?? blend;
189203
const stops = propsRef.current.colorStops ?? colorStops;
190-
program.uniforms.uColorStops.value = stops.map((hex: string) => {
191-
const c = new Color(hex);
204+
program.uniforms.uColorStops.value = stops.map((colorStr: string) => {
205+
let c: Color;
206+
if (colorStr.startsWith('rgb(')) {
207+
// Parse rgb(r,g,b) format
208+
const rgbMatch = colorStr.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
209+
if (rgbMatch) {
210+
const r = parseInt(rgbMatch[1]) / 255;
211+
const g = parseInt(rgbMatch[2]) / 255;
212+
const b = parseInt(rgbMatch[3]) / 255;
213+
c = new Color(r, g, b);
214+
} else {
215+
c = new Color('#808080'); // fallback gray
216+
}
217+
} else {
218+
c = new Color(colorStr);
219+
}
192220
return [c.r, c.g, c.b];
193221
});
194222
renderer.render({ scene: mesh });

0 commit comments

Comments
 (0)