Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> canvas { border: 2px solid #cccccc; } </style> </head> <body> <canvas id="exampleCanvas" width="300" height="150"> Your browser doesn't support the HTML5 canvas tag. </canvas> <script> var c = document.getElementById("exampleCanvas"); var ctx = c.getContext("2d"); var grd = ctx.createRadialGradient(155, 80, 20, 130, 40, 190); grd.addColorStop(0, "#14389c"); grd.addColorStop(1, "white"); ctx.fillStyle = grd; ctx.fillRect(15, 15, 270, 120); </script> </body> </html>