Prev Demo
Semicircle
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <canvas id="myCanvas" width="600" height="400"></canvas> <script> var canvas = document.getElementById('myCanvas'); var context = canvas.getContext('2d'); var centerX = canvas.width / 8; var centerY = canvas.height / 4; var radius = 50; context.beginPath(); context.arc(centerX, centerY, radius, 0, Math.PI, false); context.fillStyle = 'lime'; context.fill(); context.lineWidth = 4; context.strokeStyle = 'green'; context.stroke(); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output