<!DOCTYPE html> <html> <body> <canvas id="myCanvas" width="300" height="150" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag.</canvas> <script> var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); var grd=ctx.createRadialGradient(130,73,40,130,73,50); grd.addColorStop(0,"red"); grd.addColorStop(1,"green"); ctx.fillStyle=grd; ctx.fillRect(10,10,270,130); </script> </body> </html>
Comments 4