Created
March 18, 2012 02:51
-
-
Save cormacrelf/2068183 to your computer and use it in GitHub Desktop.
moregraphs
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
var canvas = document.getElementById('c'); | |
canvas.width = 600; | |
canvas.height = 600; | |
var ctx = canvas.getContext('2d'); | |
var draw = function(x,y){ | |
ctx.fillRect(x,600-y,1,1); | |
}; | |
ctx.fillRect(300,0,1,600); | |
ctx.fillRect(0,300,600,1); | |
var f = function(x) { | |
return Math.pow(x / 50, 2); | |
}; | |
for (j = 0; j < 600; j++) { | |
x = j - 300; | |
var y = Math.sin((x)/ 30 ) * 100; | |
y += 300; | |
draw(j,y); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment