Solve this entire Processing exercise with no aditional comments or explanations, simply…
- User
Solve this entire Processing exercise with no aditional comments or explanations, simply give me the altered code already solved: {// last name: // first name: // class: // student number:
/*
4a) Create a function that draws a mouse using parameters for x, y, and scale. Where the x and y represent the position of the nose of the mouse. And scale is the factor for the size in which the mouse should be drawn.
4b) Use the function at least 6 times with different values so each mouse has a different position and scale. Don't use values for y that are smaller than 200. You will see that all mice will look towards the mouse hole. You don't have to program that yourself.
Check the image for a visual representation. Make sure things are only drawn once in each frame. */
color black = color (4); color bgc = color (214, 194, 74); color white = color(251); color grey = color(129); color darkGrey = color (79); color brown = color (124, 74, 14); color darkBrown = color (84, 49, 14); color offBlack = color(54, 34, 14);
int xMouseHole = 598;
void setup() size (800, 800);
void draw() background(bgc);
// draw the mouse hole fill(brown); noStroke(); rect(0, 0, width, 200); fill(offBlack); arc(xMouseHole, 200, 200, 360, PI, TWO_PI); noFill( ); strokeCap(SQUARE); stroke(darkBrown); strokeWeight(50); arc(xMouseHole, 200, 200, 360, PI, TWO_PI);
// Mouse variables int x = xMouseHole; int y = height/2;
float scale = 5;
// Code below draws the mouse see it as a black box. float angle = atan2(y-200,x-xMouseHole)- HALF_PI; int size = 4; pushMatrix(); translate(x, y); rotate(angle); scale(scale); stroke(black); strokeWeight(size/4); //body fill(grey); ellipse(0, 5size, 5size, 10size); //nose fill(black); ellipse(0, 0, size, size); //eyes fill(white); ellipse(int(1.5size), int(1.7size), 2size, 2size); ellipse(int(-1.5size), int(1.7size), 2size, 2size); fill(black); ellipse(int(1.5size), int(1.3size), size, size); ellipse(int(-1.5size), int(1.3size), size, size); //ears fill(darkGrey); pushMatrix(); translate(int(1.6size), int(4size)); rotate(radians(325)); ellipse(0, 0, 2size, 4size); popMatrix(); pushMatrix(); translate(-int(1.6size), int(4size)); rotate(radians(35)); ellipse(0, 0, 2size, 4size); popMatrix(); //tail noFill(); bezier(0, 10size, 2size, 15size, -2size, 15size, 0, 20*size); popMatrix();
// last name: // first name: // class: // student number:
/*
4a) Create a function that draws a mouse using parameters for x, y, and scale. Where the x and y represent the position of the nose of the mouse. And scale is the factor for the size in which the mouse should be drawn.
- Assistant
color black = color (4); color bgc = color (214, 194, 74); color white = color(251); color grey = color(129); color darkGrey = color (79); color brown = color (124, 74, 14); color darkBrown = color (84, 49, 14); color offBlack = color(54, 34, 14); int xMouseHole = 598; void setup() { size (800, 800); } void draw() { background(bgc); // draw the mouse hole fill(brown); noStroke(); rect(0, 0, width, 200); fill(offBlack); arc(xMouseHole, 200, 200, 360, PI, TWO_PI); noFill(); strokeCap(SQUARE); stroke(darkBrown); strokeWeight(50); arc(xMouseHole, 200, 200, 360, PI, TWO_PI); drawMouse(100, 210, 1.5); drawMouse(200, 250, 2); drawMouse(300, 300, 1); drawMouse(400, 350, 3); drawMouse(500, 400, 0.8); drawMouse(550, 420, 2.5); } void drawMouse(float x, float y, float scl) { float angle = atan2(y-200,x-xMouseHole) - HALF_PI; int size = 4; pushMatrix(); translate(x, y); rotate(angle); scale(scl); stroke(black); strokeWeight(size/4); //body fill(grey); ellipse(0, 5*size, 5*size, 10*size); //nose fill(black); ellipse(0, 0, size, size); //eyes fill(white); ellipse(int(1.5*size), int(1.7*size), 2*size, 2*size); ellipse(int(-1.5*size), int(1.7*size), 2*size, 2*size); fill(black); ellipse(int(1.5*size), int(1.3*size), size, size); ellipse(int(-1.5*size), int(1.3*size), size, size); //ears fill(darkGrey); pushMatrix(); translate(int(1.6*size), int(4*size)); rotate(radians(325)); ellipse(0, 0, 2*size, 4*size); popMatrix(); pushMatrix(); translate(-int(1.6*size), int(4*size)); rotate(radians(35)); ellipse(0, 0, 2*size, 4*size); popMatrix(); //tail noFill(); bezier(0, 10*size, 2*size, 15*size, -2*size, 15*size, 0, 20*size); popMatrix(); }