xxxxxxxxxx
160
let rackets = [];
function preload() {
img = loadImage('img.jpg');
}
function setup() {
createCanvas(360, 540);
//image(img, 0, 0, width, height);
}
// let zoom=1
// let mov =1;
function draw() {
// if(zoom>=1.2)
// {
// mov=-1;
// }
// if(zoom<=1)
// {
// mov=1;
// }
// zoom+=mov*0.0015;
// scale(zoom);
background(0,100,100)
// Hair
fill(0);
beginShape();
vertex(107,212);
vertex(87, 131);
vertex(117, 90);
vertex(203, 85);
vertex(235, 113);
vertex(228, 198);
vertex(196, 138);
vertex(113, 160);
endShape(CLOSE);
//Neck
fill(215,156,121);
strokeWeight(0.25);
beginShape();
vertex(128,262);
vertex(131, 296);
vertex(153, 328);
vertex(212, 325);
vertex(223, 280);
vertex(219, 236);
vertex(167, 280);
endShape(CLOSE);
// Face
fill(215,156,121);
beginShape();
vertex(107,212);
vertex(121, 252);
vertex(135, 268);
vertex(167, 280);
vertex(196, 270);
vertex(215, 249);
vertex(228, 198);
vertex(196, 138);
vertex(113, 160);
endShape(CLOSE);
// Ears
fill(215,156,121);
ellipse(103, 207, 20, 35);
ellipse(103, 207, 15, 30);
ellipse(231, 200, 20, 35);
ellipse(231, 200, 15, 30);
// Eyes
fill(255);
ellipse(136, 192, 20, 10);
ellipse(189, 186, 20, 10);
fill(0);
ellipse(136, 192, 6.5, 6.5);
ellipse(189, 186, 6.5, 6.5);
// Eyebrows
noFill();
stroke(0);
strokeWeight(3);
arc(136, 186, 30, 20, PI+PI/9, TWO_PI-PI/6);
arc(189, 180, 30, 20, PI+PI/6, TWO_PI-PI/8);
//Nose
fill(215,156,121);
strokeWeight(0.25);
beginShape();
vertex(155,188);
vertex(167, 188);
vertex(167, 204);
vertex(174, 214);
vertex(163, 219);
vertex(148, 215);
vertex(157, 204);
endShape(CLOSE);
// Mouth
fill(222,144,137);
arc(163, 240, 40, 18, 0, PI);
fill(222,144,137);
arc(163, 237, 40, 10, PI, TWO_PI);
fill(255)
rect(148,237,30,3)
fill(224,255,255)
strokeWeight(0)
triangle(38,328,127,289,160,340)
triangle(220,280,210,330,330,330)
rect(27, 328, 310, 600, 20);
strokeWeight(0.2)
triangle(28,334,-70,540,30,540)
triangle(336,334,336,540,420,540)
fill(10)
rect(147,328,70,215)
for (let racket of rackets) {
drawR(racket.x, racket.y, racket.angle);
}
print(mouseX +","+mouseY);
}
function mousePressed() {
rackets.push({
x: mouseX,
y: mouseY,
angle: random(0,2*PI)
});
}
function drawR(x, y, angle) {
push();
translate(x, y);
rotate(angle);
// Racket handle
fill(120, 70, 40);
rect(-5, 0, 10, 30);
// Rubber
fill(200, 0, 0);
ellipse(0, -15, 40, 40);
pop();
}