xxxxxxxxxx
var stars = [];
function setup() {
createCanvas(600, 600);
for (var i = 0; i < 1000; i++) {
stars[i] = new Star();
}
}
function draw() {
background(0);
for (var i = 0; i < stars.length; i++) {
stars[i].draw();
textFont("Cinzel");
fill(255);
noStroke();
textSize(30);
text("I N T E R S T E L L A R",60,200);
fill(250,250,200);//moon
ellipse(0, 600, 500,500);
fill(0);//crater
ellipse(100, 400, 50,50);
ellipse(100, 500, 20,20);
ellipse(0, 450, 40,40);
ellipse(200, 500, 40,40);
ellipse(100, 600, 40,40);
fill(255);
ellipse(100, 397, 50,45);
ellipse(100, 497, 20,15);
ellipse(0, 447, 40,35);
ellipse(200, 497, 40,35);
ellipse(100, 600, 40,35);
fill(70,130,225);//earth
ellipse(600, 0, 200, 200);
fill(90,190,136);
ellipse(600, 0, 50, 100);
ellipse(600, 0, 80, 80);
ellipse(510, 0, 25, 50);
}
}
// star class //
class Star {
constructor() {
this.x = random(width);
this.y = random(height);
this.size = random(0.30, 3);
this.t = random(TAU);
}
draw() {
this.t += 0.6;
var scale = this.size + sin(this.t) * 1;
fill(140,150,250);
ellipse(this.x, this.y, scale, scale);
}
}