console
function setup() {
createCanvas(900,600);
background(200);
rectMode(CENTER);
}
function draw() {
Penguin(200,400,0.5,255,80,80,25);
Penguin(100,300,0.1,222,173,210,30);
Penguin(700,250,1,141,115,146,20);
Penguin(300,300,0.2,162,53,178,40);
Penguin(100,120,0.5,83,70,208,50);
Penguin(400,100,0.4,24,110,121,30);
Penguin(400,500,0.4,225,180,134,15);
Penguin(70,550,0.2,124,147,205,10);
Penguin(250,150,0.3,236,240,175,35);
Penguin(440,300,0.3,124,205,168,50);
}
function Penguin(x,y,s,a,b,c,d){
push();
translate(x,y);
scale(s);
//两条腿
noStroke();
fill(255,160,45);
ellipse(-100,225,100,50);
ellipse(100,225,100,50);
//身子形态和颜色
fill(a,b,c);
ellipse(-150,90,60,235);
ellipse(150,90,60,235);
rect(0,100,300,250);
stroke(a,b,c);
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,d,d);
ellipse(70,-80,d,d);
//嘴巴
noStroke();
fill(255,160,45);
triangle(-15,-50,15,-50,0,-25);
pop();
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.min.js"></script>