xxxxxxxxxx
57
function setup() {
createCanvas(400, 400);
}
function draw() {
background(0)
// planet base
fill(200, 0, 15);
noStroke(200, 0, 15);
ellipse(width * 0.5, height * 0.5, width * 0.25, height * 0.25)
fill(150, 0, 15);
noStroke(200, 0, 15);
ellipse(width * 0.5, height * 0.5, width * 0.2, height * 0.25)
noFill(200, 0, 15);
stroke(100);
ellipse(width * 0.5, height * 0.5, width * 0.25, height * 0.25)
//stars
fill(255)
ellipse(width * 0.1, height * 0.9, width * 0.01, height * 0.01)
ellipse(width * 0.7, height * 0.9, width * 0.01, height * 0.01)
ellipse(width * 0.1, height * 0.1, width * 0.01, height * 0.01)
ellipse(width * 0.8, height * 0.1, width * 0.01, height * 0.01)
ellipse(width * 0.2, height * 0.3, width * 0.01, height * 0.01)
ellipse(width * 0.9, height * 0.7, width * 0.01, height * 0.01)
ellipse(width * 0.5, height * 0.7, width * 0.01, height * 0.01)
ellipse(width * 0.4, height * 0.3, width * 0.01, height * 0.01)
ellipse(width * 0.4, height * 0.15, width * 0.01, height * 0.01)
ellipse(width * 0.7, height * 0.3, width * 0.01, height * 0.01)
ellipse(width * 0.2, height * 0.3, width * 0.01, height * 0.01)
ellipse(width * 0.25, height * 0.8, width * 0.01, height * 0.01)
ellipse(width * 0.25, height * 0.6, width * 0.01, height * 0.01)
ellipse(width * 0.3, height * 0.95, width * 0.01, height * 0.01)
ellipse(width * 0.4, height * 0.85, width * 0.01, height * 0.01)
// white orbit
push()
translate(width / 2, height / 2);
noFill(200, 0, 15);
stroke(255);
rotate(PI / 15);
ellipse(0, 0, width * 0.8, height * 0.2)
pop()
//randomizing stars experiment
for (let i = 0; i < 30; i++) {
let r = random(0.01, 0.99);
let rx = random(0.01, 0.99);
fill(255)
ellipse(width * r, height * rx, width * 0.01, height * 0.01);
}
}