Skip to content

Commit 5f37498

Browse files
Add 3D animated cubes, ruled paper background, vignette effect, and Times font for hero
Co-authored-by: NekshaDeSilva <102156620+NekshaDeSilva@users.noreply.github.com>
1 parent b50078b commit 5f37498

File tree

2 files changed

+139
-5
lines changed

2 files changed

+139
-5
lines changed

index.html

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,17 @@
1010

1111
<!-- Brand Portfolio Styles -->
1212
<link rel="stylesheet" href="styles/brand-portfolio.css">
13+
14+
<!-- Three.js for 3D Background -->
15+
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
1316
</head>
1417
<body>
18+
<!-- 3D Background Canvas -->
19+
<canvas id="bg-canvas"></canvas>
20+
21+
<!-- Vignette Overlay -->
22+
<div class="vignette-overlay"></div>
23+
1524
<!-- Hero Section -->
1625
<section class="hero">
1726
<div class="container">
@@ -170,5 +179,85 @@ <h3 class="committee-year-title">2024</h3>
170179
</div>
171180
</div>
172181
</footer>
182+
183+
<!-- Three.js 3D Background Script -->
184+
<script>
185+
// Three.js setup for animated cubes background
186+
const canvas = document.getElementById('bg-canvas');
187+
const scene = new THREE.Scene();
188+
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
189+
const renderer = new THREE.WebGLRenderer({ canvas, alpha: true, antialias: true });
190+
191+
renderer.setSize(window.innerWidth, window.innerHeight);
192+
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
193+
194+
// Create cubes
195+
const cubes = [];
196+
const cubeCount = 30;
197+
198+
for (let i = 0; i < cubeCount; i++) {
199+
const size = Math.random() * 0.8 + 0.2;
200+
const geometry = new THREE.BoxGeometry(size, size, size);
201+
202+
// Randomly choose between black wireframe and white wireframe
203+
const isWhite = Math.random() > 0.5;
204+
const material = new THREE.MeshBasicMaterial({
205+
color: isWhite ? 0xffffff : 0x1d1d1f,
206+
wireframe: true,
207+
transparent: true,
208+
opacity: 0.15
209+
});
210+
211+
const cube = new THREE.Mesh(geometry, material);
212+
213+
// Random positions spread across the scene
214+
cube.position.x = (Math.random() - 0.5) * 20;
215+
cube.position.y = (Math.random() - 0.5) * 20;
216+
cube.position.z = (Math.random() - 0.5) * 15 - 5;
217+
218+
// Random rotation speeds
219+
cube.userData = {
220+
rotationSpeedX: (Math.random() - 0.5) * 0.01,
221+
rotationSpeedY: (Math.random() - 0.5) * 0.01,
222+
rotationSpeedZ: (Math.random() - 0.5) * 0.005,
223+
floatAmplitude: Math.random() * 0.5 + 0.2,
224+
floatSpeed: Math.random() * 0.5 + 0.3,
225+
floatOffset: Math.random() * Math.PI * 2,
226+
initialY: cube.position.y
227+
};
228+
229+
scene.add(cube);
230+
cubes.push(cube);
231+
}
232+
233+
camera.position.z = 5;
234+
235+
// Animation loop
236+
let time = 0;
237+
function animate() {
238+
requestAnimationFrame(animate);
239+
time += 0.01;
240+
241+
cubes.forEach(cube => {
242+
cube.rotation.x += cube.userData.rotationSpeedX;
243+
cube.rotation.y += cube.userData.rotationSpeedY;
244+
cube.rotation.z += cube.userData.rotationSpeedZ;
245+
246+
// Gentle floating motion - oscillate around initial position
247+
cube.position.y = cube.userData.initialY + Math.sin(time * cube.userData.floatSpeed + cube.userData.floatOffset) * cube.userData.floatAmplitude;
248+
});
249+
250+
renderer.render(scene, camera);
251+
}
252+
253+
animate();
254+
255+
// Handle window resize
256+
window.addEventListener('resize', () => {
257+
camera.aspect = window.innerWidth / window.innerHeight;
258+
camera.updateProjectionMatrix();
259+
renderer.setSize(window.innerWidth, window.innerHeight);
260+
});
261+
</script>
173262
</body>
174263
</html>

styles/brand-portfolio.css

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,60 @@
1010

1111
body {
1212
font-family: 'Ubuntu', sans-serif;
13-
background-color: #ffffff;
13+
background-color: #fdfbf7;
14+
background-image:
15+
repeating-linear-gradient(
16+
transparent,
17+
transparent 31px,
18+
#e8e8e8 31px,
19+
#e8e8e8 32px
20+
);
21+
background-attachment: local;
1422
color: #1d1d1f;
1523
line-height: 1.6;
1624
-webkit-font-smoothing: antialiased;
1725
-moz-osx-font-smoothing: grayscale;
26+
position: relative;
27+
}
28+
29+
/* 3D Background Canvas */
30+
#bg-canvas {
31+
position: fixed;
32+
top: 0;
33+
left: 0;
34+
width: 100%;
35+
height: 100%;
36+
z-index: -1;
37+
pointer-events: none;
38+
}
39+
40+
/* Vignette Overlay - Shadow from corners */
41+
.vignette-overlay {
42+
position: fixed;
43+
top: 0;
44+
left: 0;
45+
width: 100%;
46+
height: 100%;
47+
pointer-events: none;
48+
z-index: 0;
49+
background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.15) 100%);
1850
}
1951

2052
.container {
2153
max-width: 980px;
2254
margin: 0 auto;
2355
padding: 0 22px;
56+
position: relative;
57+
z-index: 1;
2458
}
2559

2660
/* Hero Section */
2761
.hero {
2862
text-align: center;
2963
padding: 80px 0 60px;
64+
position: relative;
65+
z-index: 1;
66+
font-family: 'Times New Roman', Times, serif;
3067
}
3168

3269
.hero-logo {
@@ -47,7 +84,8 @@ body {
4784
display: inline-block;
4885
color: #1d1d1f;
4986
text-decoration: underline;
50-
font-size: 17px;
87+
font-family: 'Times New Roman', Times, serif;
88+
font-size: 20px;
5189
font-weight: 500;
5290
transition: opacity 0.2s ease;
5391
}
@@ -57,15 +95,17 @@ body {
5795
}
5896

5997
.hero-title {
60-
font-size: 48px;
98+
font-family: 'Times New Roman', Times, serif;
99+
font-size: 56px;
61100
font-weight: 700;
62101
letter-spacing: -0.5px;
63102
margin-bottom: 12px;
64103
color: #1d1d1f;
65104
}
66105

67106
.hero-subtitle {
68-
font-size: 21px;
107+
font-family: 'Times New Roman', Times, serif;
108+
font-size: 24px;
69109
font-weight: 400;
70110
color: #86868b;
71111
max-width: 600px;
@@ -92,6 +132,9 @@ body {
92132
.section {
93133
padding: 80px 0;
94134
border-top: 1px solid #d2d2d7;
135+
position: relative;
136+
z-index: 1;
137+
background-color: rgba(253, 251, 247, 0.9);
95138
}
96139

97140
.section-title {
@@ -206,8 +249,10 @@ body {
206249

207250
/* Committee Section - highlighted with subtle gray background for visual separation */
208251
.committee-section {
209-
background-color: #f5f5f7;
252+
background-color: rgba(245, 243, 239, 0.95);
210253
padding: 80px 0;
254+
position: relative;
255+
z-index: 1;
211256
}
212257

213258
.committee-year {

0 commit comments

Comments
 (0)