Created
June 3, 2010 23:28
-
-
Save dshaw/424664 to your computer and use it in GitHub Desktop.
Simple Rectangle Demos in SVG and Canvas
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
<canvas id="rect" width="440" height="120"></canvas> | |
<script> | |
var elem = document.getElementById('rect'); | |
context = elem.getContext('2d'); | |
context.fillStyle = "rgb(255,0,0)"; | |
context.fillRect(20, 20, 220, 120); | |
</script> |
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
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="440" height="120"> | |
<rect x="20" y="20" width="200" height="100" fill="red"/> | |
</svg> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample code for: http://frontend.dshaw.com/html5-and-why-developers-favor-canvas-over-sv [...g]