Prev Demo
Oval
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Oval</title> </head> <body> <canvas id="myCanvas" width="600" height="200"></canvas> <script> var canvas = document.getElementById('myCanvas'); var context = canvas.getContext('2d'); var centerX = 0; var centerY = 0; var radius = 50; context.save(); context.translate(300, 100); context.scale(1, 2); context.beginPath(); context.arc(0, 0, 50, 0, 2* Math.PI, false); context.restore(); context.fillStyle = 'red'; context.fill(); context.lineWidth = 10; context.strokeStyle = 'pink'; context.stroke(); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output