Skip to content

Commit ef8c8c9

Browse files
authored
Scheduled merge from dev to main
2 parents 15317fd + 93f70e9 commit ef8c8c9

39 files changed

+868
-286
lines changed

src/components/breadcrumbs/index.ts

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/components/breadcrumbs/styles.css

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/components/cd-cover/index.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import './styles.css';
2+
3+
export type cdCoverContent = {
4+
readonly coverTitle: string;
5+
readonly coverDescription: string;
6+
readonly coverImage: string;
7+
}
8+
9+
// --------------------------------------------------------------------------------
10+
11+
export function cdCover() {
12+
const cdItem = document.createElement('div');
13+
const cover = document.createElement('div');
14+
const textBlurb = document.createElement('div');
15+
const title = document.createElement('p');
16+
const description = document.createElement('p');
17+
18+
cdItem.className = 'cd-cover';
19+
cover.className = 'cover-image';
20+
textBlurb.className = 'cover-text-blurb';
21+
title.className = 'cover-title';
22+
description.className = 'cover-description';
23+
24+
title.textContent = "test";
25+
description.textContent = 'This is a test description for the CD cover.';
26+
27+
textBlurb.appendChild(title);
28+
textBlurb.appendChild(description);
29+
cdItem.appendChild(cover);
30+
cdItem.appendChild(textBlurb);
31+
32+
return cdItem;
33+
}

src/components/cd-cover/styles.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.cd-cover {
2+
max-width: 100%;
3+
text-align: center;
4+
}
5+
6+
.cover-image {
7+
width: 100%;
8+
height: 250px;
9+
background-color: #3BFFC5;
10+
}
11+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import './styles.css';
2+
3+
const textContent = '< End of line />';
4+
5+
//-----------------------------------------------------------------------
6+
7+
export function endOfLine() {
8+
const section = document.createElement("section");
9+
const text = document.createElement("p");
10+
11+
section.className = 'end-of-line';
12+
text.className = 'end-of-line';
13+
text.textContent = textContent;
14+
15+
section.appendChild(text);
16+
return section;
17+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
p.end-of-line {
2+
padding: 50px 0;
3+
font-family: "handjet", sans-serif;
4+
font-size: 2em;
5+
font-weight: 300;
6+
color: #828282;
7+
line-height: 150%;
8+
margin: 0;
9+
position: relative;
10+
animation: none;
11+
text-transform: uppercase;
12+
text-align: center;
13+
}
14+
15+
section.end-of-line:hover {
16+
p.end-of-line {
17+
animation: glitch 1s infinite;
18+
}
19+
}
20+
21+
@keyframes glitch {
22+
0% {
23+
text-shadow: 2px 2px #13573F, -2px -2px #3BFFC5;
24+
}
25+
20% {
26+
text-shadow: -2px -2px #13573F, 2px 2px #3BFFC5;
27+
}
28+
40% {
29+
text-shadow: 2px -2px #13573F, -2px 2px #3BFFC5;
30+
}
31+
60% {
32+
text-shadow: -2px 2px #13573F, 2px -2px #3BFFC5;
33+
}
34+
80% {
35+
text-shadow: 2px 2px #13573F, -2px -2px #3BFFC5;
36+
}
37+
100% {
38+
text-shadow: -2px -2px #13573F, 2px 2px #3BFFC5;
39+
}
40+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import * as THREE from "three";
2+
import {scene} from "./scene.ts";
3+
4+
let gridSpheres: { mesh: THREE.Mesh, dist: number }[] = [];
5+
let backgroundGridSpheres: { mesh: THREE.Mesh, baseY: number }[] = [];
6+
let backgroundGridSpheres2D: { mesh: THREE.Mesh, baseY: number }[][] = [];
7+
8+
export const initHomePage = () => {
9+
createWavyGridFloor();
10+
createBackgroundGrid();
11+
animateWaves();
12+
}
13+
14+
const createWavyGridFloor = () => {
15+
const size = 1000;
16+
const divisions = 40;
17+
const step = size / divisions;
18+
const halfSize = size / 2;
19+
20+
const sphereGeometry = new THREE.SphereGeometry(4, 8, 8);
21+
const sphereMaterial = new THREE.MeshBasicMaterial({ color: 0x3BFFC5, wireframe: true });
22+
23+
gridSpheres = [];
24+
25+
for (let i = 0; i <= divisions; i++) {
26+
for (let j = 0; j <= divisions; j++) {
27+
const x = -halfSize + i * step;
28+
const z = -halfSize + j * step;
29+
const dist = Math.sqrt(x * x + z * z) / halfSize; // normalized [0,1]
30+
const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial);
31+
sphere.position.set(x, 0, z);
32+
scene.add(sphere);
33+
gridSpheres.push({ mesh: sphere, dist });
34+
}
35+
}
36+
}
37+
38+
const createBackgroundGrid = () => {
39+
const size = 10000;
40+
const divisions = 50;
41+
const step = size / divisions;
42+
const halfSize = size / 2;
43+
44+
const sphereGeometry = new THREE.SphereGeometry(3, 8, 8);
45+
const sphereMaterial = new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true });
46+
47+
backgroundGridSpheres = [];
48+
backgroundGridSpheres2D = [];
49+
50+
// Create spheres and store in 2D array
51+
for (let i = 0; i <= divisions; i++) {
52+
backgroundGridSpheres2D[i] = [];
53+
for (let j = 0; j <= divisions; j++) {
54+
const x = -halfSize + i * step;
55+
const z = -halfSize + j * step - 500;
56+
const dist = Math.sqrt(x * x + z * z) / halfSize;
57+
const amplitude = -2500;
58+
const baseY = -2500 - dist * amplitude;
59+
const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial);
60+
sphere.position.set(x, baseY, z);
61+
scene.add(sphere);
62+
const sphereObj = { mesh: sphere, baseY };
63+
backgroundGridSpheres.push(sphereObj);
64+
backgroundGridSpheres2D[i][j] = sphereObj;
65+
}
66+
}
67+
68+
// Link neighbors with lines
69+
const lineMaterial = new THREE.LineBasicMaterial({ color: 0xffffff, opacity: 0.3, transparent: true });
70+
for (let i = 0; i <= divisions; i++) {
71+
for (let j = 0; j <= divisions; j++) {
72+
const current = backgroundGridSpheres2D[i][j].mesh.position;
73+
// Link to right neighbor
74+
if (i < divisions) {
75+
const right = backgroundGridSpheres2D[i + 1][j].mesh.position;
76+
const geometry = new THREE.BufferGeometry().setFromPoints([current, right]);
77+
const line = new THREE.Line(geometry, lineMaterial);
78+
scene.add(line);
79+
}
80+
// Link to bottom neighbor
81+
if (j < divisions) {
82+
const bottom = backgroundGridSpheres2D[i][j + 1].mesh.position;
83+
const geometry = new THREE.BufferGeometry().setFromPoints([current, bottom]);
84+
const line = new THREE.Line(geometry, lineMaterial);
85+
scene.add(line);
86+
}
87+
}
88+
}
89+
}
90+
91+
const animateWaves = () => {
92+
const time = performance.now() * 0.001;
93+
for (const { mesh, dist } of gridSpheres) {
94+
const { x, z } = mesh.position;
95+
const amplitude = 20 + dist * 60;
96+
mesh.position.y = Math.sin(0.01 * (x + z) + time) * amplitude - 500;
97+
}
98+
99+
requestAnimationFrame(animateWaves);
100+
}
Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,36 @@
11
import "./styles.css";
2-
import {initCamera, initScene, initStage, renderer} from "./scene.ts";
2+
import {changeDepth, initCamera, initScene, initStage, renderer} from "./scene.ts";
33
import {initBgMeshes} from "./particules.ts";
44
import {initPostProcess} from "./post-process.ts";
55
import {animate} from "./animation-loop.ts";
6+
import {initHomePage} from "./homeGrid.ts";
7+
8+
export enum BackgroundChoice {
9+
Home,
10+
Project,
11+
}
612

713
//-----------------------------------------------------------------------
814

9-
export function animatedBackground() {
15+
export function threeBackground(choice: BackgroundChoice) {
1016
initStage();
1117
initScene();
1218
initCamera();
13-
initBgMeshes();
19+
20+
if (choice === BackgroundChoice.Home) {
21+
initHomePage();
22+
}
23+
24+
if (choice === BackgroundChoice.Project) {
25+
initBgMeshes();
26+
}
27+
1428
initPostProcess();
1529
animate();
1630

1731
return renderer.domElement;
32+
}
33+
34+
export function updateBackground(newCameraDepth: number) {
35+
changeDepth(newCameraDepth);
1836
}

src/components/three-background/scene.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export let renderer: THREE.WebGLRenderer,
55
scene: THREE.Scene,
66
camera: THREE.PerspectiveCamera,
77
cameraTarget = new THREE.Vector3(0, 0 ,800),
8+
cameraDepth = 800,
89
windowWidth = window.innerWidth,
910
windowHeight = window.innerHeight;
1011

@@ -50,7 +51,10 @@ export const initCamera = () => {
5051
aspectRatio,
5152
nearPlane,
5253
farPlane);
53-
camera.position.z = 800;
54+
}
55+
56+
export function changeDepth(newDepth: number) {
57+
cameraDepth = newDepth;
5458
}
5559

5660

@@ -71,8 +75,8 @@ const onMouseMove = (event: MouseEvent) => {
7175
cameraTarget.y = mouseY * mouseSensitivity;
7276

7377
cameraTarget.clamp(
74-
new THREE.Vector3(-cameraTilt, -cameraTilt, 800),
75-
new THREE.Vector3(cameraTilt, cameraTilt, 800)
78+
new THREE.Vector3(-cameraTilt, -cameraTilt, cameraDepth),
79+
new THREE.Vector3(cameraTilt, cameraTilt, cameraDepth)
7680
);
7781
}
7882

0 commit comments

Comments
 (0)