function setup() {
createCanvas(2000,600);
background(200);
rectMode(CENTER);
for(let i=0;i<width;i+=150){
let penguinC=random(255);
let penguinA=random(255);
let penguinB=random(255);
let penguinS=random(0.25,0.6);
penguin(i,150,penguinC,penguinA,penguinB,penguinS);
}
}
function draw() {
}
function penguin(x,y,c,a,b,s){
push();
translate(x,y);
scale(s);
//两条腿
noStroke();
fill(255,180,65);
ellipse(-100,225,100,50);
ellipse(100,225,100,50);
//身子
fill(c,a,b);
ellipse(-150,90,60,235);
ellipse(150,90,60,235);
rect(0,100,300,250);
stroke(c,a,b);
strokeWeight(300);
line(0, -85, 0, 30);
//眼睛和肚皮
fill(255);
noStroke();
ellipse(-70,-80,120,120);
ellipse(70,-80,120,120);
ellipse(0,95,200,220);
//眼球
fill(0);
ellipse(-70,-80,15,15);
ellipse(70,-80,15,15);
//嘴巴
noStroke();
fill(255,160,45);
triangle(-15,-50,15,-50,0,-25);
pop();
}
console