-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0de0966
commit 31697b9
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Import necessary libraries | ||
import * as THREE from 'three'; | ||
|
||
// Set up the scene, camera, and renderer | ||
const scene = new THREE.Scene(); | ||
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); | ||
const renderer = new THREE.WebGLRenderer({ | ||
canvas: document.getElementById('canvas'), | ||
antialias: true | ||
}); | ||
|
||
// Set up the camera controls | ||
const controls = new THREE.OrbitControls(camera, renderer.domElement); | ||
|
||
// Add some basic lighting | ||
const ambientLight = new THREE.AmbientLight(0x444444); | ||
scene.add(ambientLight); | ||
const pointLight = new THREE.PointLight(0xffffff, 1, 100); | ||
pointLight.position.set(5, 5, 5); | ||
scene.add(pointLight); | ||
|
||
// Create 3D text for the resume content | ||
const resumeContent = [ | ||
{ | ||
title: 'Summary', | ||
text: 'Highly motivated and experienced software developer with a strong passion for innovation and problem-solving.' | ||
}, | ||
{ | ||
title: 'Skills', | ||
text: 'JavaScript, HTML/CSS, React, Node.js, MongoDB, etc.' | ||
}, | ||
{ | ||
title: 'Experience', | ||
text: 'Software Developer at XYZ Corporation (2018-Present)' | ||
} | ||
]; | ||
|
||
const textGeometry = new THREE.TextGeometry(resumeContent[0].title, { | ||
font: 'Arial', | ||
size: 2, | ||
height: 0.5 | ||
}); | ||
const textMaterial = new THREE.MeshBasicMaterial({ color: 0xffffff }); | ||
const textMesh = new THREE.Mesh(textGeometry, textMaterial); | ||
scene.add(textMesh); | ||
|
||
// Add interactive elements ( buttons ) | ||
const buttonGeometry = new THREE.BoxGeometry(2, 0.5, 0.5); | ||
const buttonMaterial = new THREE.MeshBasicMaterial({ color: 0x00ff00 }); | ||
const buttonMesh = new THREE.Mesh(buttonGeometry, buttonMaterial); | ||
buttonMesh.position.set(0, -2, 0); | ||
scene.add(buttonMesh); | ||
|
||
// Add event listener for button click | ||
buttonMesh.addEventListener('click', () => { | ||
console.log('Button clicked!'); | ||
}); | ||
|
||
// Add camera movement | ||
camera.position.set(0, 0, 5); | ||
|
||
// Animation loop | ||
function animate() { | ||
requestAnimationFrame(animate); | ||
controls.update(); | ||
renderer.render(scene, camera); | ||
} | ||
|
||
animate(); | ||
|
||
// Window resize event handler | ||
window.addEventListener('resize', () => { | ||
camera.aspect = window.innerWidth / window.innerHeight; | ||
camera.updateProjectionMatrix(); | ||
renderer.setSize(window.innerWidth, window.innerHeight); | ||
}); | ||
|