Skip to content

Instantly share code, notes, and snippets.

@profstein
Last active October 12, 2015 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save profstein/4e1fe18ab92dd0648ca6 to your computer and use it in GitHub Desktop.
Save profstein/4e1fe18ab92dd0648ca6 to your computer and use it in GitHub Desktop.
p5.js Draw a Window
function setup() {
//create the Canvas
createCanvas(windowWidth, windowHeight);
//black inside window
fill('black');
rect(65, 70, 125 - 30, 150);
//grid on inside of the window
strokeWeight(4);
stroke('Peru');
line(65, 70, 65, 70 + 150); //left
line(65 + 95, 70, 65 + 95, 70 + 150); //right
x = 65 + 95 / 2;
line(x, 70, x, 70 + 150); //middle vertical
line(65, 70, 65 + 95, 70); //top
line(65, 70 + 150, 65 + 95, 70 + 150); //bottom
y = 70 + 150 / 2;
line(65, y, 65 + 95, y); //middle horizontal
strokeWeight(1);
stroke('black');
//top bar
fill('peru');
rect(50, 50, 125, 20);
//bottom bar
fill('peru');
rect(50, 70 + 150, 125, 40);
} //end setup
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.4.13/p5.min.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment