<!DOCTYPE = html> <html><body> <canvas id="myCanvas" width="320" height="240" style="border:1px solid #d3d3d3;"> Use different browser. </canvas> <script> var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); gameloop=setInterval(doGameLoop,16); function doGameLoop(){ for(var i=0;i<c.height;i++){ ctx.fillStyle="rgb("+i+",0,0)"; ctx.fillRect(0,i,c.width,i); } } </script></body></html>
Saturday, March 30, 2013
HTML5 Copperbar example
This code below as a html file draws a copperbar in the canvas. A copperbar is a Rainbow like drawing that can be used as a background for games. The for loop i var is used to create the colors.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment