Last active
December 14, 2015 21:08
-
-
Save syntagmatic/5148505 to your computer and use it in GitHub Desktop.
Canvas Pseudo-Shader
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
<canvas id="painting" width=960 height=500></canvas> | |
<script> | |
// set up the canvas | |
canvas = document.getElementById("painting") | |
screen = canvas.getContext("2d") | |
// colored gradient | |
i = 255 | |
while (i--) { | |
j = 255 | |
while (j--) { | |
red = i | |
green = 255 - j | |
blue = 80 | |
screen.fillStyle = "rgb(" + red + "," + green + "," + blue + ")" | |
screen.fillRect(i,j,1,1) | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment