Help me come up with an interesting portfolio website that has a 3d animation to showcase my linkedin, github, resume, and projects. Give me all the codes
Assistant
Creating an engaging portfolio website with 3D animations can significantly enhance your online presence. Below, I'll guide you through building a sleek, single-page portfolio site that showcases your LinkedIn, GitHub, resume, and projects, all complemented by a 3D animation using Three.js, a popular JavaScript 3D library.
Overview
Technologies Used:
HTML5 for the structure.
CSS3 for styling and responsiveness.
JavaScript with Three.js for 3D animations.
Optional: You can host your resume as a downloadable PDF.
This script sets up a simple rotating cube as the 3D animation background. You can customize it or replace it with more complex models as needed.
javascript
// Initialize Scene, Camera, and Renderer
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
75, // Field of view
window.innerWidth / window.innerHeight, // Aspect ratio
0.1, // Near clipping plane
1000 // Far clipping plane
);
const renderer = new THREE.WebGLRenderer({ canvas: document.getElementById('three-canvas'), alpha: true });
renderer.setSize(window.innerWidth, window.innerHeight);
// Create a Cube
const geometry = new THREE.BoxGeometry();
const material = new THREE.MeshStandardMaterial({ color: 0x1e90ff, wireframe: false });
const cube = new THREE.Mesh(geometry, material);
scene.add(cube);
// Add Light
const ambientLight = new THREE.AmbientLight(0xffffff, 0.5);
scene.add(ambientLight);
const pointLight = new THREE.PointLight(0xffffff, 1);
pointLight.position.set(5, 5, 5);
scene.add(pointLight);
// Position Camera
camera.position.z = 5;
// Animation Loop
function animate() {
requestAnimationFrame(animate);
// Rotate the cube
cube.rotation.x += 0.01;
cube.rotation.y += 0.01;
renderer.render(scene, camera);
}
animate();
// Handle Window Resize
window.addEventListener('resize', () => {
// Update sizes
const width = window.innerWidth;
const height = window.innerHeight;
// Update camera
camera.aspect = width / height;
camera.updateProjectionMatrix();
// Update renderer
renderer.setSize(width, height);
});
5. Customizing the 3D Animation
The above script creates a simple rotating cube. To make it more unique, consider:
Changing Geometry: Replace BoxGeometry with other geometries like SphereGeometry, TorusGeometry, etc.
Adding Textures: Apply images or patterns to the material for more visual appeal.
Importing 3D Models: Use formats like GLTF or OBJ to import complex models. Three.js has loaders for various 3D formats.
Example: Rotating a Sphere with Texture
Add Texture Image:
Place your texture image (e.g., texture.jpg) in the assets/ folder.
Modify script.js:
javascript
// ... [Previous initialization code remains the same]
// Create a Sphere with Texture
const textureLoader = new THREE.TextureLoader();
const texture = textureLoader.load('assets/texture.jpg'); // Ensure the path is correct
const sphereGeometry = new THREE.SphereGeometry(1.5, 32, 32);
const sphereMaterial = new THREE.MeshStandardMaterial({ map: texture });
const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial);
scene.add(sphere);
// Remove or comment out the cube if you want only the sphere
scene.remove(cube);
// Update Animation Loop to rotate the sphere
function animate() {
requestAnimationFrame(animate);
// Rotate the sphere
sphere.rotation.y += 0.005;
sphere.rotation.x += 0.005;
renderer.render(scene, camera);
}
animate();
6. Hosting and Deploying Your Portfolio
Once your portfolio is ready, you can host it on platforms like:
GitHub Pages: Free and integrates well with GitHub repositories.
Netlify: Offers free plans with easy deployment options.
Vercel: Great for frontend projects with seamless deployments.
7. Enhancements and Best Practices
Performance Optimization: Use low-polygon models and compressed textures to ensure smooth performance.
Accessibility: Ensure that your website is accessible, with proper contrast ratios and ARIA labels where necessary.
SEO: Although it's a single-page application, include meta tags and descriptive content for better search engine visibility.
Analytics: Integrate Google Analytics or similar to track visitor interactions.
Complete Code Files
For your convenience, here are the complete code files:
With the provided code and guidance, you should be able to create a captivating portfolio website that stands out with its 3D animations. Customize the design, animations, and content to reflect your personal brand and showcase your skills effectively. Happy coding!