Skip to content

Instantly share code, notes, and snippets.

@patakk
Last active February 15, 2017 16:32
Show Gist options
  • Save patakk/625e83d888b16d5f1df6f0c80538c430 to your computer and use it in GitHub Desktop.
Save patakk/625e83d888b16d5f1df6f0c80538c430 to your computer and use it in GitHub Desktop.
PGraphics img;
void setup(){
size(500, 500, P2D);
createimg();
}
void draw(){
background(40, 60, 200);
// this part....
beginShape();
texture(img);
vertex(50, 150, 0, 0);
vertex(450, 150, img.width, 0);
vertex(350, 350, img.width, img.height);
vertex(150, 350, 0, img.height);
endShape();
}
void createimg(){
img = createGraphics(200, 200);
img.beginDraw();
img.background(200, 60, 40);
img.stroke(10);
for(float p = 0; p <= 1; p += 1.0/10){
img.line(p*img.width, 0, p*img.width, img.height);
img.line(0, p*img.height, img.width, p*img.height);
}
img.endDraw();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment