I'll help you create a professional and attractive home page for a mango drink website using Three.js and modern design elements. Here's a code structure with explanations:
html Copy code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tropical Mango | Fresh & Natural</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://unpkg.com/scrollreveal"></script>
</head>
<body>
<nav class="navbar">
<div class="logo">Tropical Mango</div>
<ul class="nav-links">
<li><a href="#home">Home</a></li>
<li><a href="#products">Products</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
<section id="hero">
<div class="hero-content">
<h1>Pure Mango Bliss</h1>
<p>Experience the taste of real mangoes in every sip</p>
<button class="cta-button">Shop Now</button>
</div>
<div id="mango-3d"></div>
</section>
<style>
:root {
--primary-color: #ff9f1c;
--secondary-color: #ffbf69;
--text-color: #2d3436;
--white: #ffffff;
}
body {
margin: 0;
font-family: 'Poppins', sans-serif;
overflow-x: hidden;
}
.navbar {
position: fixed;
width: 100%;
padding: 1.5rem;
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
display: flex;
justify-content: space-between;
align-items: center;
z-index: 1000;
}
.logo {
font-size: 1.8rem;
font-weight: 700;
color: var(--primary-color);
}
.nav-links {
display: flex;
gap: 2rem;
list-style: none;
}
.nav-links a {
text-decoration: none;
color: var(--text-color);
font-weight: 500;
transition: color 0.3s ease;
}
.nav-links a:hover {
color: var(--primary-color);
}
#hero {
height: 100vh;
display: flex;
align-items: center;
padding: 0 10%;
background: linear-gradient(45deg, #fff5e6, #fff9f0);
position: relative;
overflow: hidden;
}
.hero-content {
width: 50%;
z-index: 2;
}
.hero-content h1 {
font-size: 4rem;
margin-bottom: 1rem;
color: var(--text-color);
}
.hero-content p {
font-size: 1.2rem;
margin-bottom: 2rem;
color: #666;
}
.cta-button {
padding: 1rem 2rem;
font-size: 1.1rem;
background: var(--primary-color);
border: none;
border-radius: 30px;
color: var(--white);
cursor: pointer;
transition: transform 0.3s ease;
}
.cta-button:hover {
transform: translateY(-3px);
}
#mango-3d {
position: absolute;
right: 0;
width: 50%;
height: 100%;
}
</style>
<script>
// Three.js setup
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
const mangoContainer = document.getElementById('mango-3d');
renderer.setSize(mangoContainer.offsetWidth, mangoContainer.offsetHeight);
mangoContainer.appendChild(renderer.domElement);
// Create a simple mango shape (you can replace this with a detailed 3D model)
const geometry = new THREE.SphereGeometry(2, 32, 32);
const material = new THREE.MeshPhongMaterial({
color: 0xff9f1c,
shininess: 100
});
const mango = new THREE.Mesh(geometry, material);
scene.add(mango);
// Add lights
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);
camera.position.z = 5;
// Animation
function animate() {
requestAnimationFrame(animate);
mango.rotation.y += 0.005;
renderer.render(scene, camera);
}
animate();
// Scroll reveal initialization
ScrollReveal().reveal('.hero-content', {
origin: 'left',
distance: '50px',
duration: 1000,
delay: 200
});
// Responsive design
window.addEventListener('resize', () => {
camera.aspect = mangoContainer.offsetWidth / mangoContainer.offsetHeight;
camera.updateProjectionMatrix();
renderer.setSize(mangoContainer.offsetWidth, mangoContainer.offsetHeight);
});
</script>
</body>
</html>
Would you like me to explain any part in more detail or help you enhance specific features?