212k views
0 votes
How to code the target logo on codehs

User INFINITEi
by
7.3k points

1 Answer

0 votes

Answer:

// Set up canvas

var canvas = document.getElementById('myCanvas');

var ctx = canvas.getContext('2d');

// Draw the Target logo

ctx.beginPath();

ctx.arc(200, 200, 150, 0, 2 * Math.PI, false);

ctx.fillStyle = '#e53b3b';

ctx.fill();

ctx.beginPath();

ctx.arc(200, 200, 120, 0, 2 * Math.PI, false);

ctx.fillStyle = '#fff';

ctx.fill();

ctx.beginPath();

ctx.arc(200, 200, 90, 0, 2 * Math.PI, false);

ctx.fillStyle = '#e53b3b';

ctx.fill();

ctx.beginPath();

ctx.arc(200, 200, 60, 0, 2 * Math.PI, false);

ctx.fillStyle = '#fff';

ctx.fill();

ctx.beginPath();

ctx.arc(200, 200, 30, 0, 2 * Math.PI, false);

ctx.fillStyle = '#e53b3b';

ctx.fill();

User Tamel
by
7.3k points