Home  • Programming • HTML5

How to draw our National flag with HTML-5 Canvas tag?

<!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


nice....................
Thanks @Lokman. It is really an interesting tag. Try it....
Thumbs Up
nice

Share

Copyright © 2024. Powered by Intellect Software Ltd