Skip to content

Instantly share code, notes, and snippets.

@flempke
Created July 27, 2016 12:54
Show Gist options
  • Save flempke/9fe1213a9e6e0fe5a0886e8be4904690 to your computer and use it in GitHub Desktop.
Save flempke/9fe1213a9e6e0fe5a0886e8be4904690 to your computer and use it in GitHub Desktop.
function setup(){
// executed once
createCanvas(windowWidth, windowHeight);
background(80);
fill(70);
rect(width/2, 0, width/2, height);
}
function draw(){
// executed all the time
for(var x = 0; x < width; x+=10) {
for(var y = 0; y < height; y+=10){
if (x < width/2) {
if (mouseX < width/2){
stroke(255, 80, 80);
} else {
stroke(0);
}
} else {
if (mouseX > width/2){
stroke(80, 255, 80);
} else {
stroke(255);
}
}
strokeWeight(4);
point(x,y);
}
}
}
function windowResized(){
resizeCanvas(windowWidth, windowHeight);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment