xxxxxxxxxx
67
function setup() {
createCanvas(500, 600);
background(225);
}
function draw() {
// for the left triangle of the background
c = color('hsl(65,16%,54%)');
fill(c);
triangle(0, 0, 500, 0, 500, 600);
// for the right triangle of the background
b = color('hsl(179,43%,22%)');
fill(b);
triangle(0, 0, 0, 600, 500, 600);
// beak semi-circle right side
arc(355, 135, 175, 175, radians(270), 0);
// beak rect
b = color('hsl(37,75%,52%)');
fill(b);
rect(270, 48, 86, 87);
//feet
fill('#212c3f')
arc(340, 560, 240, 240, radians(180), 0);
//below body
noStroke();
fill('hsl(30,81%,59%)');
ellipse(150, 390, 245, 190)
// rect for feet
fill('#c2bd48');
rect(220, 440, 115, 170);
// Draw a diagonal oval
push(); // Start a new drawing state
translate(250, 300); // Move to the desired position
rotate(PI / 5); // Rotate by 45 degrees (PI/4 radians)
fill('#060d30'); // White color for the oval
ellipse(20, 15, 380, 250); // Draw the oval at the new origin
pop(); // Restore original state
//bigger one - head
fill('#212c3f')
arc(255, 180, 300, 270, radians(90), radians(270));
//head smaller semi-circle
fill('#e9e4b9')
arc(255, 120, 180, 150, radians(90), radians(270));
// Static line above the eye
stroke(0); // Set line color
line(240, 95, 180, 95); // Line for the eye
// Dynamic eye that follows the mouse cursor horizontally
let eyeX = constrain(mouseX, 190, 230); // Constrain the eye's horizontal movement
let eyeY = 107; // Keep the eye's vertical position constant
fill(0); // Set fill color for the eye
noStroke(); // No border for the eye circle
circle(eyeX, eyeY, 20); // Draw the eye circle
}