xxxxxxxxxx
74
function setup() {
createCanvas(500, 500);
}
function draw (){
background(255,0,0);//the clash punkrock red
var x = mouseX;
var y = mouseY; //255
var s = 240; //head
// head
fill(250, 128, 114); //peachy skin tone
ellipse(x, y, 130, s);
// Eyes
fill(80, 30, 10);
circle(x + 50, 220, 38);
circle(x - 40, 220, 38);
// Pupils
noStroke();
fill(0);
ellipse(x + 50, 222, 8);
ellipse(x - 40, 222, 8,);
// Nose
fill(255, 200, 170);
rect(255,235, 10, 30, 145); // Rounded nose
// Mouth found through reference page
fill(255, 0, 255); // Fuchsia smirk
arc(x,y, 40, 15, 0, PI + QUARTER_PI, CHORD);
//baseball cap function was found through Ai
drawBaseballCap(260,200,150, 80, 30, -PI / 6); // Adjust parameters as needed
}
// Define function to draw a baseball cap
function drawBaseballCap(
centerX,
centerY,
capWidth,
capHeight,
brimLength,
brimAngle
) {
// Set fill color for the cap (adjust as needed)
fill(255, 0, 255); // Red
// Calculate brim endpoint coordinates based on angle and length
const brimTipX = centerX + brimLength * cos(brimAngle);
const brimTipY = centerY + brimLength * sin(brimAngle);
// Draw the main part of the cap (rounded top)
ellipse(centerX, centerY - capHeight / 2, capWidth, capHeight);
// Draw the brim using two triangles for a smooth curve
beginShape();
// Connect cap edge to brim tip
vertex(centerX - capWidth / 2, centerY);
vertex(brimTipX, brimTipY);
// Connect brim tip to other side of cap edge
vertex(centerX + capWidth / 2, centerY);
endShape(CLOSE);
// Draw the button on the front (optional)
fill(153, 0, 153);
ellipse(centerX, centerY - (capHeight * 2) / 3, 10, 10);
}
function mousePressed() {
save('artmovementone.jpg');
}