(x, y, radius, color)
| 96 | |
| 97 | // function to draw ball |
| 98 | function drawBall(x, y, radius, color) { |
| 99 | ctx.fillStyle = color; |
| 100 | ctx.beginPath(); |
| 101 | // syntax --> arc(x, y, radius, startAngle, endAngle, antiClockwise_or_not) |
| 102 | ctx.arc(x, y, radius, 0, Math.PI * 2, true); // π * 2 Radians = 360 degrees |
| 103 | ctx.closePath(); |
| 104 | ctx.fill(); |
| 105 | } |
| 106 | |
| 107 | /* drawing functions end */ |
| 108 |