Skip to content

Commit f84442a

Browse files
authored
Weekly Main Merge
Weekly Main Merge
2 parents 4182669 + 4c38ae3 commit f84442a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1044
-353
lines changed

package-lock.json

Lines changed: 63 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@
1111
"devDependencies": {
1212
"typescript": "~5.6.2",
1313
"vite": "^6.0.5"
14+
},
15+
"dependencies": {
16+
"@types/three": "^0.173.0",
17+
"three": "^0.173.0"
1418
}
1519
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import './styles.css';
2+
3+
export enum BreadcrumbCategory {
4+
HOME = '#3BFFC5',
5+
INTERACTIVE = '#3B62FF',
6+
PROJECT = '#1E1E1E',
7+
}
8+
9+
export type BreadcrumbsLink = [
10+
name: string,
11+
path: string,
12+
category: BreadcrumbCategory,
13+
]
14+
15+
//-----------------------------------------------------------------------
16+
17+
export function breadcrumbs(links: BreadcrumbsLink[]) {
18+
const breadcrumbsContainer = document.createElement('div');
19+
const breadcrumbs = document.createElement('ul');
20+
21+
breadcrumbsContainer.className = 'breadcrumbs';
22+
breadcrumbsContainer.appendChild(breadcrumbs);
23+
24+
links.forEach(BreadcrumbsLink => {
25+
const [name, path, category] = BreadcrumbsLink;
26+
const crumb = document.createElement('li');
27+
const link = document.createElement('a');
28+
const separator = document.createElement('span');
29+
30+
link.href = path;
31+
link.textContent = name;
32+
link.style.backgroundColor = category;
33+
separator.textContent = '/';
34+
35+
breadcrumbs.appendChild(crumb);
36+
crumb.appendChild(link);
37+
crumb.appendChild(separator);
38+
});
39+
40+
return breadcrumbsContainer;
41+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
.breadcrumbs {
2+
list-style-type: none;
3+
margin: 10px 0 30px 0;
4+
padding: 0;
5+
6+
ul {
7+
list-style-type: none;
8+
text-align: center;
9+
margin: 0;
10+
padding: 0;
11+
}
12+
13+
li {
14+
display: inline-block;
15+
margin: 0 5px;
16+
line-height: 210%;
17+
color: white;
18+
font-family: "handjet", serif;
19+
}
20+
21+
li a {
22+
font-family: "handjet", serif;
23+
font-weight: 700;
24+
text-decoration: none;
25+
color: black;
26+
padding: 4px 6px;
27+
margin-right: 5px;
28+
29+
}
30+
31+
li:last-child {
32+
a {
33+
color: white;
34+
}
35+
span {
36+
display: none;
37+
}
38+
}
39+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {updateBgObjects} from "./particules.ts";
2+
import {renderWithPostProcess} from "./post-process.ts";
3+
import {camera, cameraTarget} from "./scene.ts";
4+
import * as THREE from "three";
5+
6+
let cameraLookAt = new THREE.Vector3(0, 0, 0);
7+
8+
export const animate = () => {
9+
requestAnimationFrame(animate);
10+
camera.position.lerp(cameraTarget, 0.2);
11+
camera.lookAt(cameraLookAt);
12+
13+
updateBgObjects();
14+
renderWithPostProcess();
15+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import "./styles.css";
2+
import {initCamera, initCanvas, initScene, initStage, renderer} from "./scene.ts";
3+
import {initBgMeshes} from "./particules.ts";
4+
import {initPostProcess} from "./post-process.ts";
5+
import {animate} from "./animation-loop.ts";
6+
7+
//-----------------------------------------------------------------------
8+
9+
export function animatedBackground() {
10+
initStage();
11+
initScene();
12+
initCanvas();
13+
initCamera();
14+
initBgMeshes();
15+
initPostProcess();
16+
animate();
17+
18+
return renderer.domElement;
19+
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
import * as THREE from "three";
2+
import {scene, windowHeight, windowWidth} from "./scene.ts";
3+
4+
5+
const meshWhiteMaterial = new THREE.MeshStandardMaterial( {
6+
color: 0xdddddd,
7+
wireframe: true,
8+
emissive: 0xdddddd,
9+
emissiveIntensity: 0.5,
10+
});
11+
12+
const meshBlueMaterial = new THREE.MeshStandardMaterial( {
13+
color: 0x3BFFC5,
14+
wireframe: false,
15+
emissive: 0x3BFFC5,
16+
emissiveIntensity: 0.5,
17+
});
18+
19+
20+
21+
//-----------------------------------------------------------------------
22+
23+
export const initBgMeshes = () => {
24+
for (let i = 0; i < 1000; i++) {
25+
const meshSize = Math.random() * 30 + 5;
26+
createBgMeshInMargins(
27+
new THREE.IcosahedronGeometry(meshSize, 0),
28+
meshWhiteMaterial
29+
);
30+
}
31+
32+
for (let i = 0; i < 100; i++) {
33+
const meshSize = Math.random() * 30 + 5;
34+
createBgMeshInMargins(
35+
new THREE.CylinderGeometry(meshSize, meshSize, 5, 32),
36+
meshBlueMaterial
37+
);
38+
}
39+
40+
createGiantWireSphere();
41+
createBackdropPlane();
42+
}
43+
44+
export const updateBgObjects = () => {
45+
scene.children.forEach((child) => {
46+
if (child instanceof THREE.Mesh && child.userData.rotationSpeed) {
47+
child.rotation.x += child.userData.rotationSpeed.x;
48+
child.rotation.y += child.userData.rotationSpeed.y;
49+
}
50+
});
51+
}
52+
53+
//-----------------------------------------------------------------------
54+
55+
const createBgMeshInMargins = (
56+
spawnMesh: THREE.CylinderGeometry | THREE.IcosahedronGeometry | THREE.TorusGeometry | THREE.BoxGeometry,
57+
meshMaterial: THREE.MeshStandardMaterial
58+
) => {
59+
const x = pointInMargins();
60+
const y = Math.random() * windowHeight * 15 - windowHeight * 7.5;
61+
const z = Math.random() * -2000 - 200;
62+
63+
const mesh = new THREE.Mesh( spawnMesh, meshMaterial );
64+
65+
mesh.userData.rotationSpeed = {
66+
x: Math.random() * 0.02 - 0.01,
67+
y: Math.random() * 0.02 - 0.01
68+
};
69+
70+
scene.add( mesh );
71+
mesh.position.set(x, y, z);
72+
}
73+
74+
75+
const pointInMargins = () => {
76+
const wrapper = 720;
77+
let point: number;
78+
79+
if (Math.random() < 0.5) {
80+
point = Math.random() * (windowWidth / 2 - wrapper * 2) - windowWidth / 2;
81+
} else {
82+
point = Math.random() * (windowWidth / 2 - wrapper * 2) + windowWidth / 2 + wrapper;
83+
}
84+
85+
return point;
86+
}
87+
88+
89+
const createGiantWireSphere = () => {
90+
const geometry = new THREE.IcosahedronGeometry(3250, 3);
91+
const material = new THREE.MeshBasicMaterial( {
92+
color: 0xdddddd,
93+
wireframe: true,
94+
} );
95+
96+
const sphere = new THREE.Mesh( geometry, material );
97+
scene.add(sphere);
98+
sphere.position.set(0, 0, 0);
99+
}
100+
101+
102+
const createBackdropPlane = () => {
103+
const geometry = new THREE.PlaneGeometry(windowWidth * 20, windowHeight * 20, 32, 32);
104+
const material = new THREE.MeshBasicMaterial({ color: 0x555555 });
105+
const plane = new THREE.Mesh(geometry, material);
106+
scene.add(plane);
107+
plane.position.set(windowWidth, 0, -2000);
108+
};
109+
110+

0 commit comments

Comments
 (0)