Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> </head> <body> <canvas id="exampleCanvas" width="260" height="160" style="border:1px solid #cdcdcd;"> The HTML5 canvas tag is not supported by your browser. </canvas> <script> var c = document.getElementById("exampleCanvas"); var ctx = c.getContext("2d"); var grd = ctx.createRadialGradient(150, 75, 10, 115, 90, 150); grd.addColorStop(0, "purple"); grd.addColorStop(1, "white"); ctx.fillStyle = grd; ctx.fillRect(20, 20, 220, 120); </script> </body> </html>