xxxxxxxxxx
73
let x;
let y;
function setup() {
createCanvas(600, 400);
angleMode(DEGREES);
//gradient background
c1 = color(0);
c2 = color(66, 31, 156);
setGradient(c1, c2);
x = 0
y = 0
}
function star(starX, starY) {
fill(255, 255, 255, 100);
ellipse(starX, starY, 10, 10);
}
function draw() {
fill(255, 255, 255, 150);
ellipse(10, 2, 10, 10);
star(200, 200);
star(400, 300);
star(600, 100);
star(300, 400);
star(80, 350);
star(100, 100);
star(500, 100);
star(300, 10);
star(350, 150);
star(550, 370);
//astronaut
noStroke();
fill(255,255,255);
ellipse(60,100,40,40);
fill(148, 148, 148,150);
ellipse(60,100,30,30);
fill(214, 183, 141);
ellipse(60,100,20,20);
fill(0,0,0);
ellipse(55,99,2,2);
ellipse(65,99,2,2);
fill(209, 163, 98);
ellipse(60,101.5,3,3);
fill(0,0,0);
ellipse(60,106,3.5,3.5);
fill(255,255,255);
rect(40,120,45,45);
}
function setGradient(c1, c2) {
noFill();
for (var y = 0; y < height; y++) {
var inter = map(y, 0, height, 0, 1);
var c = lerpColor(c1, c2, inter);
stroke(c);
line(0, y, width, y);
}
}