Created
November 6, 2013 12:37
-
-
Save chikoski/7335401 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset=utf-8 /> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <canvas id="canvas" width="480" height="480"></canvas> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var canvas = document.getElementById("canvas"); | |
| var ctx = canvas.getContext("2d"); | |
| var draw = function(){ | |
| if(ctx !== null){ | |
| ctx.strokeStyle = "black"; | |
| ctx.fillStyle = "black"; | |
| ctx.beginPath(); | |
| ctx.moveTo(40, 40); | |
| ctx.lineTo(240, 40); | |
| ctx.lineTo(240, 140); | |
| ctx.closePath(); | |
| ctx.stroke(); | |
| ctx.beginPath(); | |
| ctx.closePath(); | |
| ctx.moveTo(40, 60); | |
| ctx.lineTo(40, 160); | |
| ctx.lineTo(240, 160); | |
| ctx.closePath(); | |
| ctx.fill(); | |
| } | |
| }; | |
| draw(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment