Skip to content

Instantly share code, notes, and snippets.

@prisonerjohn
Created August 27, 2019 14:48
Show Gist options
  • Save prisonerjohn/d139b58390dc3c2ad3de072329c86134 to your computer and use it in GitHub Desktop.
Save prisonerjohn/d139b58390dc3c2ad3de072329c86134 to your computer and use it in GitHub Desktop.
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);
}
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);
}
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