xxxxxxxxxx
//size
let a = 300;
function setup() {
createCanvas(600, 600);
background(150);
noLoop();
}
function draw() {
//color
let rr = random(1,240);
let gg = random(1,240);
let bb = random(1,240);
//big circle size
let circleS = random(50,170);
//inside circle size , inside ellipse size
let iCircleS = random(circleS/2,circleS);
//bottom shape
noStroke();
fill(222, 226, 230);
beginShape();
vertex(a-76,a);
vertex(a-76,a+60);
vertex(a-40,a+75);
vertex(a,380);
vertex(a+40,a+75);
vertex(a+74,a+60);
vertex(a+74,a);
endShape(CLOSE);
//under circle shape
noStroke();
fill(173, 181, 189);
ellipse(a,a,a/2,a/4-5);
//the inside ellipse
stroke(255);
noFill();
ellipse(a,a-50,iCircleS/2+20,10);
//the inside circle
fill(255,200);
circle(a,a-50,iCircleS/2);
//the big circle
push();
blendMode(SCREEN);
noStroke();
fill(rr,gg,bb,150);
circle(a,a-50,circleS);
pop();
}
function keyPressed() {
//draws a new one
if (key == 'r') {
clear();
draw();
}
//download the file
if (key == 's') {
save('sphere.jpg');
}
}