Last active
August 29, 2015 13:56
-
-
Save picasso250/8973784 to your computer and use it in GitHub Desktop.
This file contains 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
<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> |
This file contains 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('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