xxxxxxxxxx
66
let butt
let options = [[141,85,36], [141, 85, 36], [198, 134, 66], [224, 172, 105], [241, 194, 125], [255, 219, 172], [197, 140, 133], [236, 188, 180], [209, 163, 164], [161, 102, 94]]
function setup() {
createCanvas(600, 600);
butt = new Butt();
}
function draw() {
var s = 1.1;
background((154) * s,(171) * s,(137) * s );
butt.display();
}
function mousePressed(){
butt = new Butt();
}
function darker(l){
var scale = 1/1.5
return [l[0] * scale , l[1] * scale, l[2] * scale];
}
class Butt{
constructor(){
this.buttw = random(0.1, 0.8) * width;
this.buttheight = random(0.1, 0.8) * width;
this.buttdroop = random(0.3, 0.8)* this.buttw;
var col = random(options);
this.col = color(col[0], col[1], col[2]);
var darker_col = darker(col);
this.strokeCol = color(darker_col[0], darker_col[1], darker_col[2]);
}
display(){
fill(this.col);
strokeWeight(7);
stroke(this.strokeCol);
push();
rectMode(CORNERS);
rect(width / 2 - this.buttw / 2, -10, width / 2 + this.buttw / 2, height + 10);
pop();
// left cheek
push();
var txl = (width / 2 - this.buttw / 4);
var tyl = this.buttheight;
translate(txl, tyl);
arc(0, 0, this.buttw / 2, this.buttdroop, 0, PI);
pop();
push();
//right cheek
var txr = (width / 2 + this.buttw / 4);
var tyr = this.buttheight;
translate(txr, tyr);
arc(0, 0, this.buttw / 2, this.buttdroop, 0, PI);
pop();
line(width / 2, this.buttheight, width / 2,height);
}
}