S2
jS
Learn
Create Your Own
Split Screen
Go to Live Site
Next Page
Here's an even better
fillCircle
where we've now added a
Colour
parameter.
<HTML> <head> <title> My new Web Page </title> </head> <body> <canvas id=myCanvas width=300 height=300 style="background-color: pink;"> </canvas> <script> var ctx = myCanvas.getContext("2d"); function fillCircle (x, y, radius, colour) { ctx.beginPath(); ctx.fillStyle= colour; ctx.arc(x, y, radius, 0, Math.PI * 2); ctx.fill(); } fillCircle(120, 120, 40, "red"); fillCircle(200, 200, 60, "blue"); fillCircle(150, 150, 20, "green"); </script> </body> </html>