src/services/utils/DrawSquare.js
// Function used to draw a square in the canvas
Function used to draw a square in the canvas
Function used to draw a square in the canvas
function drawSquare(ctx, x, y, size, color) {
  ctx.fillStyle = color;
  ctx.fillRect(x, y, size, size);
  const isHoled = rand(0, 3);
  if (isHoled === 1) {
    const newSize = (size) / 3;
    ctx.fillStyle = shadeColor(color, 40);
    ctx.fillRect(x + newSize, y + newSize, newSize, newSize);
  }
}
function drawSquare ( ctx , x , y , size , color ) { ctx . fillStyle = color ; ctx . fillRect ( x , y , size , size ) ; const isHoled = rand ( 0 , 3 ) ; if ( isHoled === 1 ) { const newSize = ( size ) / 3 ; ctx . fillStyle = shadeColor ( color , 40 ) ; ctx . fillRect ( x + newSize , y + newSize , newSize , newSize ) ; } }
Function used to draw a square in the canvas
Function used to draw a square in the canvas
// Back square // hole inside square only 33% chance to draw it