S2
jS
Learn
Create Your Own
Split Screen
Go to Live Site
Next Page
To change the thickness of the stroke:
ctx.lineWidth=4;
Challenge:
see if you can make something that looks like this:
<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"); ctx.fillStyle= "green"; ctx.fillRect(60, 80, 70, 20); ctx.lineWidth= 4; ctx.strokeStyle= "red"; ctx.strokeRect(50, 50, 20, 40); </script> </body> </html>