Skip to content

Commit 56936eb

Browse files
committed
d
1 parent 60c9fe2 commit 56936eb

File tree

4 files changed

+97
-1
lines changed

4 files changed

+97
-1
lines changed

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"react-scroll": "^1.9.0",
2727
"reactstrap": "^9.2.2",
2828
"slick-carousel": "^1.8.1",
29+
"three": "^0.162.0",
2930
"vercel": "^33.6.1",
3031
"web-vitals": "^3.5.2"
3132
},
@@ -59,6 +60,7 @@
5960
"@babel/eslint-parser": "^7.24.1",
6061
"@types/node": "^20.11.30",
6162
"@types/react-slick": "^0.23.13",
63+
"@types/three": "^0.162.0",
6264
"@typescript-eslint/eslint-plugin": "^7.3.1",
6365
"@typescript-eslint/parser": "^7.3.1",
6466
"TagCloud": "^2.5.0",

pnpm-lock.yaml

+40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/common/navbar.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ export const NavBar: React.FC = () => {
6060
<img src={feedback} width={icon_size} height={icon_size} />
6161
Feedback
6262
</Button>
63+
</NavItem>
64+
<NavItem className="nav-item">
65+
<Button style={{ border: '1px solid white' }} onClick={() => nav('/Gallery')}>
66+
<img src={feedback} width={icon_size} height={icon_size} />
67+
Gallery
68+
</Button>
6369
</NavItem>
6470
<NavItem className="nav-item" style={{ border: '1px solid white' }}>
6571
<a href="https://github.com/austinhutchen" target="_blank" rel="noopener noreferrer">

src/components/pages/gallery.tsx

+49-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import React from 'react';
1+
import React, { useRef, useEffect } from 'react';
22
import { NavBar } from '../common/navbar';
3+
import * as THREE from 'three';
4+
35

46
export const Visualizer: React.FC = () => {
57
return (
@@ -18,8 +20,54 @@ export const Visualizer: React.FC = () => {
1820
<h2> Angular Webcam Streaming interface</h2>
1921

2022
</b>
23+
24+
<hr className="my-4"/>
25+
<b>
26+
<h2> 4-DIMENSIONAL TESSERACT</h2>
27+
28+
</b>
29+
<hr/>
30+
<Tesseract/>
2131
</div>
2232
</>
2333
);
2434
};
2535

36+
37+
const Tesseract: React.FC = () => {
38+
const ref = useRef<HTMLDivElement>(null);
39+
40+
useEffect(() => {
41+
if (!ref.current) return;
42+
43+
const scene = new THREE.Scene();
44+
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
45+
const renderer = new THREE.WebGLRenderer();
46+
47+
renderer.setSize(window.innerWidth, window.innerHeight);
48+
ref.current.appendChild(renderer.domElement);
49+
50+
const geometry = new THREE.BoxGeometry(1, 1, 1);
51+
const material = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
52+
const cube = new THREE.Mesh(geometry, material);
53+
54+
scene.add(cube);
55+
56+
camera.position.z = 5;
57+
58+
const animate = function () {
59+
requestAnimationFrame(animate);
60+
61+
cube.rotation.x += 0.01;
62+
cube.rotation.y += 0.01;
63+
64+
renderer.render(scene, camera);
65+
};
66+
67+
animate();
68+
}, []);
69+
70+
return <div ref={ref} />;
71+
};
72+
73+
export default Tesseract;

0 commit comments

Comments
 (0)