Created
August 27, 2019 14:48
-
-
Save prisonerjohn/d139b58390dc3c2ad3de072329c86134 to your computer and use it in GitHub Desktop.
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
PImage shapes; | |
void settings() { | |
size(512, 512); | |
} | |
void setup() | |
{ | |
shapes = loadImage("shapes.png"); | |
} | |
void draw() | |
{ | |
background(shapes); | |
color c = shapes.get(mouseX, mouseY); | |
fill(c); | |
rect(mouseX - 25, mouseY - 25, 50, 50); | |
} |
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
PImage shapes; | |
void settings() { | |
size(512, 512); | |
} | |
void setup() | |
{ | |
shapes = loadImage("shapes.png"); | |
shapes.loadPixels(); | |
} | |
void draw() | |
{ | |
background(shapes); | |
color c = shapes.pixels[mouseY * shapes.height + mouseX]; | |
fill(c); | |
rect(mouseX - 25, mouseY - 25, 50, 50); | |
} |
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
PImage shapes; | |
void settings() { | |
size(512, 512); | |
} | |
void setup() | |
{ | |
shapes = loadImage("shapes.png"); | |
shapes.loadPixels(); | |
} | |
void draw() | |
{ | |
int index = frameCount * 24; | |
int x = index % shapes.width; | |
int y = index / shapes.width; | |
background(shapes); | |
color c = shapes.pixels[index]; | |
fill(c); | |
rect(x - 25, y - 25, 50, 50); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment