Skip to content

Commit

Permalink
Update solar.html
Browse files Browse the repository at this point in the history
  • Loading branch information
ristonrodrigues723 authored Jul 11, 2024
1 parent 532ec04 commit 0ce101e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions solar.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script>

class OrbitControls {
constructor(camera, domElement) {
this.camera = camera;
Expand Down Expand Up @@ -104,9 +104,12 @@
this.camera.position.add(this.target);
}

update() {

}
}


const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer();
Expand All @@ -131,13 +134,13 @@
starGeometry.setAttribute('position', new THREE.Float32BufferAttribute(starVertices, 3));
const stars = new THREE.Points(starGeometry, starMaterial);
scene.add(stars);



const sunGeometry = new THREE.SphereGeometry(5, 32, 32);
const sunMaterial = new THREE.MeshBasicMaterial({color: 0xFFFF00});
const sun = new THREE.Mesh(sunGeometry, sunMaterial);
scene.add(sun);


const planetData = [
{name: "Mercury", size: 0.383, distance: 10, speed: 0.02, color: 0x8A9A5B},
{name: "Venus", size: 0.949, distance: 15, speed: 0.015, color: 0xFFA500},
Expand Down Expand Up @@ -175,7 +178,7 @@
camera.position.set(0, 50, 100);
controls.update();


function animate() {
requestAnimationFrame(animate);

Expand All @@ -191,7 +194,7 @@

animate();


window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
Expand Down

0 comments on commit 0ce101e

Please sign in to comment.