Created
March 31, 2018 23:30
-
-
Save DBC-Works/172e6d3b13914ae0498a8da5543bda34 to your computer and use it in GitHub Desktop.
坂本龍一"async"ジャケット風画像生成Processingプログラム
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
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