Created
May 21, 2015 02:55
-
-
Save chikoski/ca33e219a4ddc98ef81c 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
| function draw(){ | |
| ctx.fillStyle = "rgb(32, 32, 32)"; | |
| ctx.fillRect(0, 0, canvas.width, canvas.height); | |
| var data = [20, 40, 50, 60, 30, 10, 20, 40, 70, 5, -1, -20, -5, -20, -7, -5, 5]; | |
| ctx.fillStyle = "rgb(255, 255, 255)"; | |
| var i = 0; | |
| var offset = 5; | |
| var width = (canvas.width - offset * (data.length + 1))/ data.length; | |
| while(i < data.length){ | |
| var x = offset * (i + 1) + width * i; | |
| ctx.fillRect(x, canvas.height / 2 - data[i] * 4, | |
| width, data[i] * 4); | |
| i = i + 1; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment