Skip to content

Instantly share code, notes, and snippets.

@alberto56
Created May 24, 2015 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alberto56/530d846ce9deb97c5af8 to your computer and use it in GitHub Desktop.
Save alberto56/530d846ce9deb97c5af8 to your computer and use it in GitHub Desktop.
Squares on a page
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="400" height="400" style="border:1px solid #d3d3d3;"></canvas>
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
// gauche, droite, largeur, hauteur
ctx.rect(0, 20, 150, 100);
ctx.rect(0, 20, 150, 120);
ctx.stroke();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment