Created
December 7, 2011 16:27
-
-
Save atduskgreg/1443458 to your computer and use it in GitHub Desktop.
Generating a gradient with Processing and an OpenGL texture
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
import processing.opengl.*; | |
void setup(){ | |
size(500, 500, OPENGL); | |
noStroke(); | |
} | |
void draw(){ | |
background(0); | |
fill(255,0,0); | |
rect(0,0,500,500); | |
float percentHidden = map(mouseY, 0, 500, 0, 1); | |
beginShape(QUADS); | |
fill(0,255); | |
vertex(0,0); | |
vertex(500,0); | |
fill(0,0); | |
vertex(500, 500 * percentHidden); | |
vertex(0, 500 * percentHidden); | |
endShape(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment