Skip to content

Commit

Permalink
added dwarf planets to menu
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullah-k18 committed Oct 5, 2024
1 parent 8391e00 commit f01399d
Show file tree
Hide file tree
Showing 15 changed files with 527 additions and 0 deletions.
23 changes: 23 additions & 0 deletions ceres/ceres.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/examples/js/controls/OrbitControls.js"></script>
<title>Ceres</title>
</head>
<body>
<button class="back-button" onclick="goHome()">
&#8592;
</button>

<script src="script.js"></script>
<script>
function goHome() {
window.location.href = '../index.html';
}
</script>
</body>
</html>
57 changes: 57 additions & 0 deletions ceres/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

const controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
controls.dampingFactor = 0.25;
controls.enableZoom = true;

const textureLoader = new THREE.TextureLoader();
const backgroundTexture = textureLoader.load('../textures/bg.jpg');
const backgroundGeometry = new THREE.SphereGeometry(500, 64, 64);
const backgroundMaterial = new THREE.MeshBasicMaterial({
map: backgroundTexture,
side: THREE.BackSide
});
const backgroundMesh = new THREE.Mesh(backgroundGeometry, backgroundMaterial);
scene.add(backgroundMesh);

const ceresTexture = textureLoader.load('../textures/ceres.jpg');

function createTexturedPlanet(size, texture, position) {
const geometry = new THREE.SphereGeometry(size, 32, 32);
const material = new THREE.MeshStandardMaterial({ map: texture });
const planet = new THREE.Mesh(geometry, material);
planet.position.set(position, 0, 0);
return planet;
}

const ceres = createTexturedPlanet(3, ceresTexture, 0);
scene.add(ceres);

const pointLight = new THREE.PointLight(0xffffff, 2, 100);
pointLight.position.set(0, 0, 0);
scene.add(pointLight);

const ambientLight = new THREE.AmbientLight(0x404040);
scene.add(ambientLight);

camera.position.set(10, 0, 0);
camera.lookAt(0, 0, 0);

function animate() {
requestAnimationFrame(animate);
controls.update();
renderer.render(scene, camera);
}

animate();

window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
25 changes: 25 additions & 0 deletions ceres/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
body {
margin: 0;
overflow: hidden;
}

canvas {
display: block;
}

.back-button {
position: absolute;
top: 20px;
left: 20px;
background-color: rgba(0, 0, 0, 0.7);
color: white;
border: none;
cursor: pointer;
padding: 10px;
font-size: 24px;
z-index: 10;
}

.back-button:hover {
background-color: rgba(0, 0, 0, 0.9);
}
23 changes: 23 additions & 0 deletions eris/eris.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/examples/js/controls/OrbitControls.js"></script>
<title>Eris</title>
</head>
<body>
<button class="back-button" onclick="goHome()">
&#8592;
</button>

<script src="script.js"></script>
<script>
function goHome() {
window.location.href = '../index.html';
}
</script>
</body>
</html>
57 changes: 57 additions & 0 deletions eris/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

const controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
controls.dampingFactor = 0.25;
controls.enableZoom = true;

const textureLoader = new THREE.TextureLoader();
const backgroundTexture = textureLoader.load('../textures/bg.jpg');
const backgroundGeometry = new THREE.SphereGeometry(500, 64, 64);
const backgroundMaterial = new THREE.MeshBasicMaterial({
map: backgroundTexture,
side: THREE.BackSide
});
const backgroundMesh = new THREE.Mesh(backgroundGeometry, backgroundMaterial);
scene.add(backgroundMesh);

const erisTexture = textureLoader.load('../textures/eris.jpg');

function createTexturedPlanet(size, texture, position) {
const geometry = new THREE.SphereGeometry(size, 32, 32);
const material = new THREE.MeshStandardMaterial({ map: texture });
const planet = new THREE.Mesh(geometry, material);
planet.position.set(position, 0, 0);
return planet;
}

const eris = createTexturedPlanet(3, erisTexture, 0);
scene.add(eris);

const pointLight = new THREE.PointLight(0xffffff, 2, 100);
pointLight.position.set(0, 0, 0);
scene.add(pointLight);

const ambientLight = new THREE.AmbientLight(0x404040);
scene.add(ambientLight);

camera.position.set(10, 0, 0);
camera.lookAt(0, 0, 0);

function animate() {
requestAnimationFrame(animate);
controls.update();
renderer.render(scene, camera);
}

animate();

window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
25 changes: 25 additions & 0 deletions eris/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
body {
margin: 0;
overflow: hidden;
}

canvas {
display: block;
}

.back-button {
position: absolute;
top: 20px;
left: 20px;
background-color: rgba(0, 0, 0, 0.7);
color: white;
border: none;
cursor: pointer;
padding: 10px;
font-size: 24px;
z-index: 10;
}

.back-button:hover {
background-color: rgba(0, 0, 0, 0.9);
}
23 changes: 23 additions & 0 deletions haumea/haumea.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/examples/js/controls/OrbitControls.js"></script>
<title>Haumea</title>
</head>
<body>
<button class="back-button" onclick="goHome()">
&#8592;
</button>

<script src="script.js"></script>
<script>
function goHome() {
window.location.href = '../index.html';
}
</script>
</body>
</html>
59 changes: 59 additions & 0 deletions haumea/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

const controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
controls.dampingFactor = 0.25;
controls.enableZoom = true;

const textureLoader = new THREE.TextureLoader();
const backgroundTexture = textureLoader.load('../textures/bg.jpg');
const backgroundGeometry = new THREE.SphereGeometry(500, 64, 64);
const backgroundMaterial = new THREE.MeshBasicMaterial({
map: backgroundTexture,
side: THREE.BackSide
});
const backgroundMesh = new THREE.Mesh(backgroundGeometry, backgroundMaterial);
scene.add(backgroundMesh);

const haumeaTexture = textureLoader.load('../textures/haumea.jpg');

function createEllipsoidPlanet(sizeX, sizeY, sizeZ, texture, position) {
const geometry = new THREE.SphereGeometry(1, 32, 32);
geometry.scale(sizeX, sizeY, sizeZ);
const material = new THREE.MeshStandardMaterial({ map: texture });
const planet = new THREE.Mesh(geometry, material);
planet.position.set(position, 0, 0);
return planet;
}

const haumea = createEllipsoidPlanet(3, 1.5, 1.5, haumeaTexture, 0);
haumea.rotation.y = Math.PI / 2;
scene.add(haumea);

const pointLight = new THREE.PointLight(0xffffff, 2, 100);
pointLight.position.set(0, 0, 0);
scene.add(pointLight);

const ambientLight = new THREE.AmbientLight(0x404040);
scene.add(ambientLight);

camera.position.set(10, 0, 0);
camera.lookAt(0, 0, 0);

function animate() {
requestAnimationFrame(animate);
controls.update();
renderer.render(scene, camera);
}

animate();

window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
25 changes: 25 additions & 0 deletions haumea/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
body {
margin: 0;
overflow: hidden;
}

canvas {
display: block;
}

.back-button {
position: absolute;
top: 20px;
left: 20px;
background-color: rgba(0, 0, 0, 0.7);
color: white;
border: none;
cursor: pointer;
padding: 10px;
font-size: 24px;
z-index: 10;
}

.back-button:hover {
background-color: rgba(0, 0, 0, 0.9);
}
23 changes: 23 additions & 0 deletions makemake/makemake.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/examples/js/controls/OrbitControls.js"></script>
<title>Makemake</title>
</head>
<body>
<button class="back-button" onclick="goHome()">
&#8592;
</button>

<script src="script.js"></script>
<script>
function goHome() {
window.location.href = '../index.html';
}
</script>
</body>
</html>
Loading

0 comments on commit f01399d

Please sign in to comment.