xxxxxxxxxx
162
let fly = 210
let hatY = -80
function setup() {
createCanvas(400, 600);
frameRate(30)
}
function draw() {
background(208, 245, 255 );
wings()
movewing()
body()
face()
movehat()
legs()
angleMode(DEGREES);
//face
function face(){
//left ear
push()
translate(60,-50)
rotate(30)
fill(255,226,139)
ellipse(150,100,70,50)
fill(226,226,226)
ellipse(150,100,35,20)
pop()
//right ear
push()
translate(80,100)
rotate(-30)
fill(255,226,139)
ellipse(150,100,70,50)
fill(226,226,226)
ellipse(150,100,35,20)
pop()
//roundface
fill(255,226,139)
ellipse(200,150,100,110);
//eyes
fill("white")
ellipse(183,140,30,40)
ellipse(217,140,30,40)
push()
fill("black")
ellipse(183,140,15,18)
ellipse(217,140,15,18)
pop()
//mouth
fill("black")
ellipse(200,180,30,10)
//hat
push()
fill(235,211,234)
translate(0, hatY)
triangle(200,60,230,110,170,110)
pop()
}
//body
function body(){
//torso
push()
noStroke()
fill(161,143,170)
ellipse(200,250,100,140)
pop()
//x in the middle
push()
noStroke()
fill("white")
translate(-100,150)
rotate(-35)
rect(180,225,15,60)
pop()
push()
noStroke()
fill("white")
translate(190,-65)
rotate(35)
rect(180,225,15,60)
pop()
}
function legs(){
push()
noStroke()
fill("green")
rect(158,290,84,30,10)
//leg
rect(158,290,30,100,10)
//leg
rect(212,290,30,100,10)
pop()
// fill("green")
// ellipse(227,380,30,20)
// ellipse(174,380,30,20)
}
function wings(){
push()
noStroke()
//left wing
fill(156,209,220)
wingL = quad(100, 200, 180, 190, 130, 250, 20, fly);
//right wing
quad(300, 200, 220, 190, 270, 250, 380, fly);
pop()
}
function movewing(){
fly = fly + 1;
if (fly > 290) {
fly = 210
}
}
function movehat(){
hatY = hatY + 1;
if (hatY > 0) {
hatY = -80
}
}
}