Skip to content

Instantly share code, notes, and snippets.

@picasso250
Last active August 29, 2015 13:56
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 picasso250/8973784 to your computer and use it in GitHub Desktop.
Save picasso250/8973784 to your computer and use it in GitHub Desktop.
<style type="text/css">
canvas { border: 1px solid #000; position:absolute; top:0;left:0;
visibility: hidden; }
</style>
<canvas id="MainCanvas" width="480" height="640"></canvas>
<canvas id="SecondCanvas" width="480" height="640"></canvas>
<script type="text/javascript" src="bird.js"></script>
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var rectWidth = 150;
var rectHeight = 75;
context.fillStyle = 'blue';
context.fillRect(rectWidth / -2, rectHeight / -2, rectWidth,rectHeight);
// translate context to center of canvas
context.translate(canvas.width / 2, canvas.height / 2);
context.fillStyle = 'blue';
context.fillRect(rectWidth / -2, rectHeight / -2, rectWidth, rectHeight);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment