Question: javascript draw the cat like below picture(draw cat I give) picture Cat function drawCat(x,y){ ctx.save(); ctx.translate(x,y); ctx.fillStyle = brown; ctx.beginPath(); ctx.arc(0,0,25,0,2*Math.PI); ctx.fill(); ctx.strokeStyle = orange;

javascript draw the cat like below picture(draw cat I give)

javascript draw the cat like below picture(draw cat I give) picture Cat

picture Cat

function drawCat(x,y){

ctx.save();

ctx.translate(x,y);

ctx.fillStyle = "brown";

ctx.beginPath();

ctx.arc(0,0,25,0,2*Math.PI);

ctx.fill();

ctx.strokeStyle = "orange";

ctx.beginPath();

ctx.lineTo(-37.5,0);

ctx.lineTo(-12.5,0);

ctx.moveTo(12.5,0);

ctx.lineTo(37.5,0);

ctx.moveTo(-35,-12);

ctx.lineTo(-14,-4);

ctx.moveTo(14,-4);

ctx.lineTo(35,-12);

ctx.moveTo(-35,12);

ctx.lineTo(-14,4);

ctx.moveTo(14,4);

ctx.lineTo(35,12);

ctx.stroke();

ctx.beginPath();

ctx.moveTo(-17.6,-17.6);

ctx.lineTo(-15,-30);

ctx.lineTo(-5.41,-24.4);

ctx.moveTo(17.6,-17.6);

ctx.lineTo(15,-30);

ctx.lineTo(5.41,-24.4);

ctx.stroke();

ctx.fill();

ctx.fillStyle = "black";

ctx.beginPath();

ctx.arc(-12.5,-12.5,2,0,2*Math.PI);

ctx.arc(12.5,-12.5,2,0,2*Math.PI);

ctx.fill();

ctx.fillStyle = "red";

ctx.beginPath();

ctx.arc(0, 0, 19, 0, Math.PI);

ctx.fill();

ctx.restore();

}

Assignment 5 Pattern 1 Pattern 2 Pattern 3 Pattern 4 Pattern 5 Assignment 5 Pattern 1 Pattern 2 Pattern 3 Pattern 4 Pattern 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!