src/services/utils/DrawArc.js
// Function used to draw a circle in the canvas
Function used to draw a circle in the canvas
Function used to draw a circle in the canvas
function drawArc(ctx, x, y, size, color) {
  const bg = shadeColor(color, 40);
  ctx.fillStyle = bg;
  ctx.fillRect(x, y, size, size);
  const rayon = Math.max((size) / 2, 0);
  ctx.fillStyle = color;
  ctx.beginPath();
  ctx.arc(x + rayon, y + rayon, rayon, 0, 2 * Math.PI, false);
  ctx.fill();
  const isHoled = rand(0, 3);
  if (isHoled === 1) {
    ctx.fillStyle = bg;
    ctx.beginPath();
    ctx.arc(x + rayon, y + rayon, rayon / 3, 0, 2 * Math.PI, false);
    ctx.fill();
  }
}
function drawArc ( ctx , x , y , size , color ) { const bg = shadeColor ( color , 40 ) ; ctx . fillStyle = bg ; ctx . fillRect ( x , y , size , size ) ; const rayon = Math . max ( ( size ) / 2 , 0 ) ; ctx . fillStyle = color ; ctx . beginPath ( ) ; ctx . arc ( x + rayon , y + rayon , rayon , 0 , 2 * Math . PI , false ) ; ctx . fill ( ) ; const isHoled = rand ( 0 , 3 ) ; if ( isHoled === 1 ) { ctx . fillStyle = bg ; ctx . beginPath ( ) ; ctx . arc ( x + rayon , y + rayon , rayon / 3 , 0 , 2 * Math . PI , false ) ; ctx . fill ( ) ; } }
Function used to draw a circle in the canvas
Function used to draw a circle in the canvas
// Back square // draw circle // draw a hole inside circle (33% chance to draw it)