Skip to content

Instantly share code, notes, and snippets.

@DBC-Works
Created March 31, 2018 23:30
Show Gist options
  • Save DBC-Works/172e6d3b13914ae0498a8da5543bda34 to your computer and use it in GitHub Desktop.
Save DBC-Works/172e6d3b13914ae0498a8da5543bda34 to your computer and use it in GitHub Desktop.
坂本龍一"async"ジャケット風画像生成Processingプログラム
int x;
PImage sourceImg;
void setup() {
size(1280, 720);
x = (int)random(width);
sourceImg = loadImage("(set image file path here)");
sourceImg.resize(width, height);
frameRate(24);
}
void draw(){
PImage drawImg = createImage(width, height, RGB);
drawImg.copy(sourceImg, 0, 0, x, height, 0, 0, x, height);
drawImg.copy(sourceImg, x, 0, 1, height, x, 0, width - x, height);
image(drawImg, 0, 0);
++x;
if (width <= x) {
x = (int)random(width);
drawImg = sourceImg.copy();
}
}
void mouseReleased(){
x = mouseX;
}
void keyPressed() {
if (key == ' ') {
saveFrame("toposcan-######.png");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment