Last active
December 31, 2018 12:48
-
-
Save wonderburg7/969a478423928f7573b6998ade65e394 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 img1, img2, img3, img4, img5, img6, img7; | |
int rotationCount = 0; | |
int picSize; | |
int countValue = 1; | |
int delay = 70; | |
static final color BG = -4; | |
void setup() { | |
size(500, 500); | |
// noSmooth(); | |
// ((PGraphicsOpenGL)g).textureSampling(2); | |
img1 = loadImage("https://i.imgur.com/qNr33dN.png"); | |
imageMode(CENTER); | |
picSize = height; | |
img1 = loadImage("hexagon 2.png"); | |
img2 = loadImage("photo branches.png"); | |
img3 = loadImage("shutter 1.png"); | |
img4 = loadImage("shutter 2.png"); | |
img5 = loadImage("shutter 3.png"); | |
img6 = loadImage("shutter 4.png"); | |
img7 = loadImage("shutter 5.png"); | |
int picheight = height, picwidth = width; | |
img1.resize(picheight, picwidth); | |
img2.resize(picheight, picwidth); | |
img3.resize(picheight, picwidth); | |
img4.resize(picheight, picwidth); | |
img5.resize(picheight, picwidth); | |
img6.resize(picheight, picwidth); | |
img7.resize(picheight, picwidth); | |
// img1.resize(picSize, picSize); | |
// img2.resize(picSize, picSize); | |
} | |
void draw() { | |
background(BG); | |
//background(255, 0); | |
picSize = height; | |
translate(width/2, height/2); | |
pushMatrix(); | |
rotate(radians(rotationCount)); | |
popMatrix(); | |
image(img2,0,0, picSize, picSize); | |
if (countValue == 1+delay) { | |
image(img3, 0, 0, picSize, picSize); | |
} else if (countValue == 2+delay) { | |
image(img4,0, 0, picSize, picSize); | |
} else if (countValue == 3+delay) { | |
image(img5, 0, 0, picSize, picSize); | |
} else if (countValue == 4+delay) { | |
image(img6, 0, 0, picSize, picSize); | |
} else if (countValue == 5+delay) { | |
image(img7, 0, 0, picSize, picSize); | |
} else if (countValue == 6+delay) { | |
image(img6, 0, 0, picSize, picSize); | |
} else if (countValue == 7+delay) { | |
image(img5,0, 0, picSize, picSize); | |
} else if (countValue == 8+delay) { | |
image(img4,0, 0, picSize, picSize); | |
} else if (countValue == 9+delay) { | |
image(img5,0, 0, picSize, picSize); | |
} else if (countValue == 10+delay) { | |
image(img6,0, 0, picSize, picSize); | |
} else if (countValue == 11+delay) { | |
image(img7,0, 0, picSize, picSize); | |
} else if (countValue == 12+delay) { | |
image(img6,0, 0, picSize, picSize); | |
} else if (countValue == 13+delay) { | |
image(img5, 0, 0, picSize, picSize); | |
} else if (countValue == 14+delay) { | |
image(img4, 0, 0, picSize, picSize); | |
} else { | |
image(img3, 0, 0, picSize, picSize); | |
} | |
countValue++; | |
if (countValue == delay*2){ | |
countValue = 1; | |
} | |
rotationCount++; | |
//saveTransparentCanvas(BG, "img"); | |
if (rotationCount == 360){ | |
rotationCount = 0; | |
} | |
saveTransparentCanvas(BG, "img"); | |
} | |
void saveTransparentCanvas(final color bg, final String name) { | |
final PImage canvas = get(0,0,height,width); | |
canvas.format = ARGB; | |
final color p[] = canvas.pixels, bgt = bg & ~#000000; | |
for (int i = 0; i != p.length; ++i) if (p[i] == bg) p[i] = bgt; | |
canvas.updatePixels(); | |
canvas.save("photo"+frameCount+".png"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment