12345678910111213141516171819202122232425 |
- let ctx = canvas.getContext("2d");
- ctx.beginPath();
- ctx.arc(50, 50, 50, Math.PI/6, -Math.PI/6, false);
- ctx.lineTo(50, 50);
- ctx.closePath();
- ctx.strokeStyle = 'black';
- ctx.fillStyle = "green";
- ctx.fill();
- ctx.stroke();
- ctx.beginPath();
- ctx.arc(57, 25, 5, 0, 2 * Math.PI);
- ctx.fillStyle = "black";
- ctx.fill();
- ctx.stroke();
- function drawCircle(e){
- ctx.beginPath();
- ctx.arc(e.layerX, e.layerY, 5, 0, 2 * Math.PI, false);
- ctx.fillStyle ="yellow";
- ctx.fill()
- ctx.stroke();
- }
- canvas.addEventListener("click", drawCircle);
|