let canvas = document.getElementById("canvas");
let ctx = canvas.getContext("2d");
ctx.beginPath();
ctx.linewidth = 2;
ctx.strokeStyle = "black";
function drawCircle(x, y, r) {
ctx.arc(x, y, r, 0, 2 * Math.PI, false);
if (r > 2) {
drawCircle(x + r + 10, y, r * 0.5);
}
ctx.stroke();
}
drawCircle(300, 300, 70)
<canvas id="canvas" width="600" height="600"></canvas>
here's an example of the drawing. Circle
I still don't understand recursion, especially in canvas. I find it difficult to understand.
I want to make a row of circles if possible. What should I do? Please help
A simple row of circles will, I just want to understand how will I be able to do it.