Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
851 commits
Select commit Hold shift + click to select a range
1d3fc9a
Update index.js
topherchris420 Nov 13, 2023
7fc6f6a
Update index.js
topherchris420 Nov 13, 2023
86a45ba
Update index.js
topherchris420 Nov 20, 2023
55e93cc
Update index.js
topherchris420 Nov 28, 2023
06cc6ef
Update index.js
topherchris420 Nov 28, 2023
d326972
Update index.js
topherchris420 Nov 28, 2023
a42944b
Update index.js
topherchris420 Nov 28, 2023
bbfaf02
Update index.js
topherchris420 Nov 28, 2023
ff8a429
Update index.js
topherchris420 Jan 12, 2024
6c74b04
Update index.js
topherchris420 Jan 24, 2024
4e788f8
Update index.js
topherchris420 Jan 24, 2024
8e126f3
Update index.js
topherchris420 Jan 24, 2024
6d9d32c
Update index.js
topherchris420 Feb 26, 2024
0bc86eb
Update index.js
topherchris420 Feb 26, 2024
3cac54b
Update index.js
topherchris420 Feb 29, 2024
a678a4d
Update index.js
topherchris420 Feb 29, 2024
1f9a466
Update index.js
topherchris420 Feb 29, 2024
7c9b6ea
Update index.js
topherchris420 Feb 29, 2024
99829ee
Update index.js
topherchris420 Mar 2, 2024
d4fa6c3
Update index.js
topherchris420 Mar 5, 2024
39bc4ba
Update index.js
topherchris420 Mar 5, 2024
45c9e1c
Update index.js
topherchris420 Mar 6, 2024
72ed6b9
Update index.js
topherchris420 Mar 6, 2024
ded1118
Update index.js
topherchris420 Mar 6, 2024
70ffc01
Update index.js
topherchris420 Mar 6, 2024
e7e4ad9
Update index.js
topherchris420 Mar 6, 2024
5ed3c66
Update index.js
topherchris420 Mar 7, 2024
eb38302
Update index.js
topherchris420 Mar 7, 2024
b6baff9
Update index.js
topherchris420 Mar 7, 2024
e220819
Update index.js
topherchris420 Mar 7, 2024
b5fbbae
Update index.js
topherchris420 Mar 7, 2024
9bc13a0
Update index.js
topherchris420 Mar 8, 2024
f3088d2
Update index.js
topherchris420 Mar 9, 2024
2cd8fcd
Update index.js
topherchris420 Mar 9, 2024
3486d3b
Update Home.module.css
topherchris420 Mar 10, 2024
26ff797
Update Home.module.css
topherchris420 Mar 10, 2024
3f28928
Update Home.module.css
topherchris420 Mar 10, 2024
b1c5cda
Update globals.css
topherchris420 Mar 10, 2024
48f2d39
Update globals.css
topherchris420 Mar 10, 2024
b83855f
Update index.js
topherchris420 Mar 10, 2024
4b3fb8e
Update index.js
topherchris420 Mar 10, 2024
d67e7fe
Update index.js
topherchris420 Mar 10, 2024
9e7d7df
Update index.js
topherchris420 Mar 11, 2024
49607ff
Update index.js
topherchris420 Mar 11, 2024
6567cda
Update index.js
topherchris420 Mar 12, 2024
0bea106
Update index.js
topherchris420 Mar 12, 2024
9d1caea
Update index.js
topherchris420 Mar 12, 2024
2d2cc31
Update index.js
topherchris420 Mar 12, 2024
e3ad5d3
Update index.js
topherchris420 Mar 12, 2024
7c30f01
Update index.js
topherchris420 Mar 12, 2024
f37939b
Update index.js
topherchris420 Mar 12, 2024
0766be7
Update index.js
topherchris420 Mar 12, 2024
52cff57
Update index.js
topherchris420 Mar 12, 2024
fbbd6ea
Update index.js
topherchris420 Mar 12, 2024
80fa9d7
Update README.md
topherchris420 Mar 13, 2024
48abf96
Update index.js
topherchris420 Mar 13, 2024
a34c4f7
Update index.js
topherchris420 Mar 13, 2024
0e41dc8
Update index.js
topherchris420 Mar 13, 2024
df7b6d8
Update index.js
topherchris420 Mar 13, 2024
e70f4d7
Update index.js
topherchris420 Mar 14, 2024
c23e889
Update index.js
topherchris420 Mar 14, 2024
a187020
Update index.js
topherchris420 Mar 14, 2024
6ff5908
Update index.js
topherchris420 Mar 14, 2024
fe9eb06
Update index.js
topherchris420 Mar 14, 2024
2c5b253
Update index.js
topherchris420 Mar 14, 2024
4eb2e09
Update index.js
topherchris420 Mar 14, 2024
1098dcd
Update index.js
topherchris420 Mar 14, 2024
bc31f9e
Update index.js
topherchris420 Mar 14, 2024
e8c22fa
Update index.js
topherchris420 Mar 14, 2024
f47d5d4
Update index.js
topherchris420 Mar 14, 2024
61f038e
Update index.js
topherchris420 Mar 14, 2024
98e49a0
Update index.js
topherchris420 Mar 14, 2024
63fcfee
Update index.js
topherchris420 Mar 15, 2024
f5f3bea
Update index.js
topherchris420 Mar 15, 2024
93a2716
Update index.js
topherchris420 Mar 16, 2024
6f72382
Update index.js
topherchris420 Mar 17, 2024
cbc17db
Update index.js
topherchris420 Mar 17, 2024
6e4e490
Update index.js
topherchris420 Mar 17, 2024
907b7b6
Update index.js
topherchris420 Mar 17, 2024
e768ebb
Update index.js
topherchris420 Mar 17, 2024
c27d833
Create node.js.yml
topherchris420 Mar 17, 2024
25c498f
Delete .github/workflows directory
topherchris420 Mar 17, 2024
170b5c9
Update index.js
topherchris420 Mar 17, 2024
5d964ab
Update index.js
topherchris420 Mar 17, 2024
e9021be
Update index.js
topherchris420 Mar 19, 2024
b2c12b5
Update index.js
topherchris420 Mar 19, 2024
6b112a8
Update index.js
topherchris420 Mar 24, 2024
4db6847
Update index.js
topherchris420 Mar 24, 2024
8380897
Update index.js
topherchris420 Mar 24, 2024
c783495
Update index.js
topherchris420 Mar 24, 2024
65d8c59
Update index.js
topherchris420 Mar 24, 2024
cefc193
Update index.js
topherchris420 Mar 24, 2024
0f92a5d
Update index.js
topherchris420 Mar 24, 2024
ff15d7e
Update index.js
topherchris420 Mar 24, 2024
b7a4f17
Update index.js
topherchris420 Mar 24, 2024
b380585
Update index.js
topherchris420 Mar 24, 2024
a7cfe73
Update index.js
topherchris420 Mar 24, 2024
4a7ee22
Update index.js
topherchris420 Mar 24, 2024
14ed8f9
Update index.js
topherchris420 Mar 24, 2024
f4ba417
Update index.js
topherchris420 Mar 24, 2024
1d94d46
Update index.js
topherchris420 Mar 24, 2024
8b94e14
Update index.js
topherchris420 Mar 24, 2024
cce11e1
Update index.js
topherchris420 Mar 24, 2024
4e3fb69
Update index.js
topherchris420 Mar 24, 2024
1e6f212
Update index.js
topherchris420 Mar 24, 2024
9e848e3
Update index.js
topherchris420 Mar 25, 2024
c6fa2f2
Update index.js
topherchris420 Mar 25, 2024
3f350d8
Delete pages/favicon.ico
topherchris420 Mar 25, 2024
c1a98d5
Update index.js
topherchris420 Mar 25, 2024
945eb8b
Update index.js
topherchris420 Mar 25, 2024
266842a
Update index.js
topherchris420 Mar 25, 2024
0f61aa2
Update index.js
topherchris420 Mar 29, 2024
6ff1fcb
Update index.js
topherchris420 Mar 31, 2024
80c8b59
Update index.js
topherchris420 Mar 31, 2024
769af24
Update index.js
topherchris420 Apr 7, 2024
e083cfb
Update index.js
topherchris420 Apr 7, 2024
8dc9e76
Update index.js
topherchris420 Apr 7, 2024
36afdbe
Update index.js
topherchris420 Apr 7, 2024
47922cd
Update index.js
topherchris420 Apr 7, 2024
80438f1
Update index.js
topherchris420 Apr 7, 2024
4144cea
Update index.js
topherchris420 May 17, 2024
12a5467
Update index.js
topherchris420 May 17, 2024
3a49424
Update index.js
topherchris420 May 22, 2024
c13bbdc
Update index.js
topherchris420 May 22, 2024
c7ae59f
Update index.js
topherchris420 May 27, 2024
e4b2381
Update index.js
topherchris420 Jun 28, 2024
76d20fc
Update index.js
topherchris420 Jul 7, 2024
0a2a8e6
Update index.js
topherchris420 Mar 30, 2025
5011f68
Update Home.module.css
topherchris420 Mar 30, 2025
502c24d
Update package.json
topherchris420 Mar 30, 2025
8395298
Update index.js
topherchris420 Mar 30, 2025
bd3a818
Create VantaEffect.js
topherchris420 Mar 30, 2025
72b61c2
Update index.js
topherchris420 Mar 30, 2025
e5843a0
Update package.json
topherchris420 Apr 4, 2025
8e37bdc
Update index.js
topherchris420 Apr 4, 2025
25af4d2
Update index.js
topherchris420 Apr 4, 2025
680690e
Update index.js
topherchris420 Apr 4, 2025
f5ec24e
Update VantaEffect.js
topherchris420 Apr 4, 2025
04e5e61
Update index.js
topherchris420 Apr 4, 2025
10d113a
Update VantaEffect.js
topherchris420 Apr 4, 2025
2845077
Update index.js
topherchris420 Apr 4, 2025
9258cac
Add files via upload
topherchris420 Apr 4, 2025
fe5d2e6
Update index.js
topherchris420 Apr 4, 2025
e5071b0
Update index.js
topherchris420 Apr 4, 2025
1ef8329
Update VantaEffect.js
topherchris420 Apr 4, 2025
dea93ce
Update index.js
topherchris420 Apr 4, 2025
f7e9039
Update VantaEffect.js
topherchris420 Apr 4, 2025
121a250
Update index.js
topherchris420 Apr 4, 2025
0e84a35
Update index.js
topherchris420 Apr 4, 2025
b8bebc6
Update VantaEffect.js
topherchris420 Apr 14, 2025
1a1e5ae
Update Home.module.css
topherchris420 Apr 14, 2025
1a7ce38
Update index.js
topherchris420 Apr 14, 2025
19fbce0
Update index.js
topherchris420 Apr 14, 2025
a86a6b5
Create AudioPlayer.js
topherchris420 Apr 14, 2025
76d9d9d
Update Home.module.css
topherchris420 Apr 14, 2025
260ceea
Update AudioPlayer.js
topherchris420 Apr 14, 2025
90de7e7
Update VantaEffect.js
topherchris420 Apr 14, 2025
f7df727
Delete components/AudioPlayer.js
topherchris420 Apr 14, 2025
179a965
Update VantaEffect.js
topherchris420 Apr 14, 2025
b4e8ad8
Update index.js
topherchris420 Apr 14, 2025
e3abe70
Update Home.module.css
topherchris420 Apr 14, 2025
d2246ee
Add files via upload
topherchris420 Apr 18, 2025
cbb4745
Update index.js
topherchris420 Apr 18, 2025
ea6c93d
Update index.js
topherchris420 Apr 18, 2025
b7cde0f
Add files via upload
topherchris420 Apr 19, 2025
eb85610
Delete public/20250415_0903_Glowing Sacred Capsule_simple_compose_01j…
topherchris420 Apr 19, 2025
b504750
Update index.js
topherchris420 Apr 19, 2025
cf7268e
Delete public/assets_task_01js7bnvh2fj0v2w05ey6fty87_img_0_1_1_1.jpg
topherchris420 Apr 20, 2025
bd242f8
Add files via upload
topherchris420 Apr 20, 2025
5136d9b
Update index.js
topherchris420 Apr 20, 2025
9b083fe
Add files via upload
topherchris420 Apr 21, 2025
d5cb3ca
Update index.js
topherchris420 Apr 21, 2025
e3a8f62
Update Home.module.css
topherchris420 Apr 27, 2025
46556a0
Update index.js
topherchris420 Apr 27, 2025
4160033
Add files via upload
topherchris420 Apr 27, 2025
db9cf8a
Update index.js
topherchris420 Apr 27, 2025
2e34c1b
Update Home.module.css
topherchris420 Apr 27, 2025
ba5aad3
Update Home.module.css
topherchris420 Apr 27, 2025
4086d97
Update index.js
topherchris420 Apr 27, 2025
83fc555
Add files via upload
topherchris420 Apr 27, 2025
4e0c601
Update index.js
topherchris420 Apr 27, 2025
11f5c2b
Update index.js
topherchris420 Apr 27, 2025
4e619d9
Update index.js
topherchris420 Apr 27, 2025
69ef0fa
Update index.js
topherchris420 Apr 30, 2025
6623c86
Update index.js
topherchris420 Apr 30, 2025
52033f9
Update index.js
topherchris420 May 4, 2025
06442f1
Update index.js
topherchris420 May 4, 2025
13332d3
Update index.js
topherchris420 May 4, 2025
33500f8
Update index.js
topherchris420 May 5, 2025
6f35f2c
Update index.js
topherchris420 May 5, 2025
5d58a39
Update index.js
topherchris420 May 5, 2025
e70b1d7
Delete public/Mit.jpg
topherchris420 May 5, 2025
52f51bb
Add files via upload
topherchris420 May 5, 2025
75344fe
Update index.js
topherchris420 May 5, 2025
00ffc08
Update index.js
topherchris420 May 5, 2025
6e663bf
Delete vers3dynamics-art.jpg
topherchris420 May 10, 2025
00835c9
Update index.js
topherchris420 May 11, 2025
3f4c272
Update index.js
topherchris420 May 11, 2025
8c6bb5b
Update index.js
topherchris420 May 11, 2025
077bc8e
Update index.js
topherchris420 May 12, 2025
3954f73
Delete public/logo.png
topherchris420 May 13, 2025
839b79c
Add files via upload
topherchris420 May 13, 2025
4b02f71
Update index.js
topherchris420 May 13, 2025
9f4c69c
Update index.js
topherchris420 May 21, 2025
e37fe41
Update Home.module.css
topherchris420 May 21, 2025
28f3bd6
Add files via upload
topherchris420 May 21, 2025
8f1b9d9
Update index.js
topherchris420 May 21, 2025
20f0967
Add files via upload
topherchris420 May 21, 2025
29dc69d
Update index.js
topherchris420 May 21, 2025
c6418a3
Update index.js
topherchris420 May 21, 2025
b4ff896
Update index.js
topherchris420 May 21, 2025
70b6cce
Update index.js
topherchris420 May 21, 2025
0d0f82f
Update index.js
topherchris420 May 22, 2025
b010a39
Update index.js
topherchris420 May 23, 2025
dcd3150
Update index.js
topherchris420 May 23, 2025
4b7115e
Update index.js
topherchris420 Jun 9, 2025
b77bec5
Update index.js
topherchris420 Aug 17, 2025
9abb818
Update contact email in footer
topherchris420 Jan 8, 2026
c632172
Update package.json
topherchris420 Jan 8, 2026
0cb8b68
Update Node.js engine version to 22.x
topherchris420 Jan 8, 2026
fdc5185
Add Node.js version to .nvmrc
topherchris420 Jan 8, 2026
1a30ff1
Delete goTo (2).wav
topherchris420 Jan 8, 2026
43546a4
Add portfolio link to README
topherchris420 Jan 8, 2026
24002ce
Update links in biography section
topherchris420 Jan 31, 2026
a5c75dc
Fix link text and punctuation in biography section
topherchris420 Jan 31, 2026
fd3f1ea
Replace vanta net background with full-screen ripple shader
topherchris420 Feb 13, 2026
ab45c94
Merge pull request #2 from topherchris420/codex/redesign-website-for-…
topherchris420 Feb 13, 2026
8dcbcf2
Brighten full-screen ripple shader background
topherchris420 Feb 13, 2026
87d623c
Merge branch 'main' into codex/redesign-website-for-modern-look-sjtfte
topherchris420 Feb 13, 2026
2151565
Update header and subtitle text in index.js
topherchris420 Feb 13, 2026
f17b233
feat: add aria labels and focus styles for accessibility
google-labs-jules[bot] Feb 14, 2026
ed36256
⚡ Bolt: Remove duplicate Three.js and debounce resize
google-labs-jules[bot] Feb 14, 2026
02546d9
Merge pull request #4 from topherchris420/palette/improve-accessibili…
topherchris420 Feb 14, 2026
6e1addd
Merge pull request #5 from topherchris420/perf/remove-duplicate-three…
topherchris420 Feb 14, 2026
a7056e6
feat: improve UX and accessibility of links
topherchris420 Feb 15, 2026
7604693
⚡ Bolt: Optimize VantaEffect component performance
topherchris420 Feb 16, 2026
f8081fc
Merge pull request #3 from topherchris420/codex/redesign-website-for-…
topherchris420 Feb 17, 2026
fec6275
Merge pull request #6 from topherchris420/palette-ux-improvements-151…
topherchris420 Feb 17, 2026
446b76c
Merge pull request #8 from topherchris420/perf/optimize-three-imports…
topherchris420 Feb 17, 2026
d874dbc
⚡ Bolt: Disable unnecessary WebGL antialiasing
topherchris420 Feb 17, 2026
1dd2c9e
feat(a11y): add reduced motion support to Vanta.js background
topherchris420 Feb 17, 2026
39c0aa8
Merge pull request #10 from topherchris420/perf/disable-webl-antialia…
topherchris420 Feb 18, 2026
8edd0a0
Merge pull request #11 from topherchris420/palette-reduced-motion-132…
topherchris420 Feb 18, 2026
15c181e
⚡ Bolt: Optimize VantaEffect for Reduced Motion
topherchris420 Feb 19, 2026
d10b2d2
Merge pull request #14 from topherchris420/perf/vanta-reduced-motion-…
topherchris420 Feb 19, 2026
106aaa7
Add accessible scroll-to-top button
topherchris420 Feb 21, 2026
220a9d2
Merge pull request #19 from topherchris420/palette/scroll-to-top-1054…
topherchris420 Feb 21, 2026
f36df78
Update index.js
topherchris420 Feb 28, 2026
bdfa9aa
Update index.js
topherchris420 Feb 28, 2026
2eb3f27
Improve code quality: fix CSS bug, reduce unnecessary work
claude Mar 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .Jules/bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## 2026-02-14 - Redundant Library Loading
**Learning:** Manually injecting library scripts (like Three.js) via CDN while also importing the library as a dependency leads to double loading, version conflicts, and wasted bandwidth.
**Action:** Always check if a library is already bundled before adding a CDN script. Use the bundled version whenever possible.

## 2026-02-19 - WebGL Animation Efficiency
**Learning:** In WebGL animation loops (using `requestAnimationFrame`), simply pausing the state update (e.g., `time`) when reduced motion is preferred is insufficient; the `renderer.render()` call must also be skipped to save GPU resources.
**Action:** Implement conditional rendering in animation loops: only call `renderer.render()` when animation is active or on resize events to update static views.
7 changes: 7 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## 2026-02-17 - WebGL Reduced Motion
**Learning:** Custom WebGL implementations using `requestAnimationFrame` do not automatically respect `prefers-reduced-motion` settings, potentially causing vestibular issues.
**Action:** Always check `window.matchMedia('(prefers-reduced-motion: reduce)').matches` in custom animation loops to pause or simplify effects.

## 2026-02-18 - Glassmorphism Consistency
**Learning:** The project uses `backdrop-filter: blur(8px)` with specific `rgba` backgrounds for UI containers.
**Action:** Apply this pattern to new floating elements (like scroll-to-top) to maintain visual consistency.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
32 changes: 2 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,2 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/import?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
![Screenshot_20230513_215640_Photo_Editor_Pro_-_Polish](https://github.com/topherchris420/vanta/assets/93827718/616c1cab-be33-4b63-a6fe-c44abc5e31ab)
my portfolio
48 changes: 48 additions & 0 deletions components/ScrollToTop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { useEffect, useState } from "react";
import styles from "../styles/Home.module.css";

const ScrollToTop = () => {
const [isVisible, setIsVisible] = useState(false);

useEffect(() => {
const toggleVisibility = () => {
const shouldShow = window.scrollY > 300;
setIsVisible((prev) => (prev !== shouldShow ? shouldShow : prev));
};

window.addEventListener("scroll", toggleVisibility);
return () => window.removeEventListener("scroll", toggleVisibility);
}, []);

const scrollToTop = () => {
window.scrollTo({
top: 0,
behavior: "smooth",
});
};

return (
<button
onClick={scrollToTop}
className={`${styles.scrollToTop} ${isVisible ? styles.visible : ""}`}
aria-label="Scroll to top"
type="button"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
width="24"
height="24"
>
<path d="M18 15l-6-6-6 6" />
</svg>
</button>
);
};

export default ScrollToTop;
173 changes: 173 additions & 0 deletions components/VantaEffect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
import { useEffect, useRef } from "react";
import {
Camera,
Scene,
PlaneGeometry,
Vector2,
ShaderMaterial,
Mesh,
WebGLRenderer,
} from "three";

// Simple debounce utility to limit the rate of execution
const debounce = (func, wait) => {
let timeout;
return function executedFunction(...args) {
const later = () => {
clearTimeout(timeout);
func(...args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
};

const vertexShader = `
void main() {
gl_Position = vec4(position, 1.0);
}
`;

const fragmentShader = `
precision mediump float;
uniform vec2 resolution;
uniform float time;

void main(void) {
vec2 uv = (gl_FragCoord.xy * 2.0 - resolution.xy) / min(resolution.x, resolution.y);
float t = time * 0.04;
float r = length(uv);

float wave1 = sin(34.0 * r - t * 8.0);
float wave2 = sin(52.0 * r - t * 10.0 + 1.4);
float wave3 = sin(72.0 * r - t * 12.0 + 2.2);

float rings = 0.55 + 0.28 * wave1 + 0.22 * wave2 + 0.15 * wave3;

float pulse = 0.5 + 0.5 * sin(t * 2.6 - r * 30.0);
float halo = 0.15 / max(0.025, abs(fract((r - t * 0.22) * 14.0) - 0.5));
float fade = smoothstep(1.4, 0.0, r);

vec3 deepBlue = vec3(0.02, 0.05, 0.16);
vec3 cyan = vec3(0.12, 0.86, 1.00);
vec3 violet = vec3(0.70, 0.38, 1.00);
vec3 pink = vec3(1.00, 0.42, 0.78);

vec3 sweep = mix(cyan, violet, 0.5 + 0.5 * sin(t * 0.9 + r * 12.0));
vec3 sweep2 = mix(sweep, pink, 0.5 + 0.5 * cos(t * 0.7 - r * 9.0));

float intensity = clamp(rings * 0.72 + pulse * 0.35 + halo * 0.45, 0.0, 1.2);
vec3 color = mix(deepBlue, sweep2, intensity) * fade + sweep2 * 0.06;

gl_FragColor = vec4(color, 1.0);
}
`;

const VantaEffect = ({ className }) => {
const containerRef = useRef(null);
const sceneRef = useRef(null);

useEffect(() => {
if (!containerRef.current) {
return;
}

const container = containerRef.current;

const camera = new Camera();
camera.position.z = 1;

const scene = new Scene();
const geometry = new PlaneGeometry(2, 2);

const uniforms = {
time: { value: 1.0 },
resolution: { value: new Vector2() },
};

const material = new ShaderMaterial({
uniforms,
vertexShader,
fragmentShader,
});

const mesh = new Mesh(geometry, material);
scene.add(mesh);

// Disable antialiasing for performance as we render a full-screen quad
const renderer = new WebGLRenderer({ antialias: false, alpha: false });
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.setClearColor(0x000000, 1);

container.appendChild(renderer.domElement);

// Reduced motion support
const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
let isReduced = mediaQuery.matches;

let animationId = 0;

const startAnimation = () => {
const animate = () => {
uniforms.time.value += 0.05;
renderer.render(scene, camera);
animationId = window.requestAnimationFrame(animate);
};
animationId = window.requestAnimationFrame(animate);
};

const stopAnimation = () => {
window.cancelAnimationFrame(animationId);
animationId = 0;
};

const handleMotionChange = (e) => {
isReduced = e.matches;
if (isReduced) {
stopAnimation();
} else {
startAnimation();
}
};

mediaQuery.addEventListener("change", handleMotionChange);

const onWindowResize = () => {
const width = container.clientWidth;
const height = container.clientHeight;
renderer.setSize(width, height, false);
uniforms.resolution.value.set(renderer.domElement.width, renderer.domElement.height);
renderer.render(scene, camera);
};

// Debounce the resize event to improve performance
const debouncedResize = debounce(onWindowResize, 200);

onWindowResize();
window.addEventListener("resize", debouncedResize);

sceneRef.current = { renderer, geometry, material, animationId };
if (!isReduced) {
startAnimation();
}

return () => {
window.removeEventListener("resize", debouncedResize);
mediaQuery.removeEventListener("change", handleMotionChange);
stopAnimation();

if (renderer.domElement && renderer.domElement.parentNode === container) {
container.removeChild(renderer.domElement);
}

geometry.dispose();
material.dispose();
renderer.dispose();
sceneRef.current = null;
};
}, []);

return <div ref={containerRef} className={className} />;
};

export default VantaEffect;
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
"name": "vanta",
"version": "0.1.0",
"private": true,
"engines": {
"node": "22.x"
},
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "10.0.2",
"react": "17.0.1",
"react-dom": "17.0.1",
"three": "^0.122.0",
"vanta": "^0.5.21"
"next": "latest",
"react": "latest",
"react-dom": "latest",
"three": "^0.156.0",
"vanta": "^0.5.24"
}
}
15 changes: 0 additions & 15 deletions pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
import "../styles/globals.css";
import { useEffect } from "react";

function MyApp({ Component, pageProps }) {
useEffect(() => {
const threeScript = document.createElement("script");
threeScript.setAttribute("id", "threeScript");
threeScript.setAttribute(
"src",
"https://cdnjs.cloudflare.com/ajax/libs/three.js/r121/three.min.js"
);
document.getElementsByTagName("head")[0].appendChild(threeScript);
return () => {
if (threeScript) {
threeScript.remove();
}
};
}, []);
return <Component {...pageProps} />;
}

Expand Down
Loading