Add completed solar system with one planet

This commit is contained in:
Lev
2021-07-24 17:31:44 -05:00
parent 18a9af012d
commit 42fd5884bd
3 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="p5.min.js"></script>
<script src="sketch.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,22 @@
function setup() {
createCanvas(900, 600, WEBGL);
angleMode(DEGREES);
}
function draw() {
background(125);
// sun
sphere(100, 10, 10);
pointLight(255, 255, 255, 0, 0, 0);
pointLight(255, 255, 255, 0, 0, 0);
// earth
translate( cos(frameCount) * 300, 0, sin(frameCount) * 300);
rotateY(frameCount);
ambientMaterial(255);
sphere(50, 10, 10);
// camera
camera(0, -500, 800);
}