Last active
November 22, 2018 21:56
-
-
Save wonderburg7/8db02cfb0e2aff0a0fe6ec84624846bd 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, img8, img; | |
float i = 0; | |
static final color BG = -4; | |
void setup() | |
{ | |
size(1000,1000,P3D); | |
img1 = loadImage("assembly (1).png"); | |
img2 = loadImage("assembly (2).png"); | |
img3 = loadImage("assembly (3).png"); | |
img4 = loadImage("assembly (4).png"); | |
img5 = loadImage("assembly (5).png"); | |
img6 = loadImage("assembly (6).png"); | |
img7 = loadImage("assembly (7).png"); | |
img8 = loadImage("assembly (8).png"); | |
int picheight = 300,picwidth = 300; | |
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); | |
img8.resize(picheight, picwidth); | |
} | |
void draw(){ | |
background(BG); | |
if (frameCount <= 5){ | |
img = img1; | |
} else if (frameCount <= 13){ | |
img = img2; | |
} else if (frameCount <= 21){ | |
img = img3; | |
} else if (frameCount <= 29){ | |
img = img4; | |
} else if (frameCount <= 37){ | |
img = img5; | |
} else if (frameCount <= 45){ | |
img = img6; | |
} else if (frameCount <= 53){ | |
img = img7; | |
} else if (frameCount <= 61){ | |
img = img8; | |
} else if (frameCount <= 77){ | |
img = img1; | |
} | |
pushMatrix(); | |
// Move the coordinate system to the center of the screen | |
translate(width/2.0, height/2.0); | |
// Rotate the coordinate system a bit more each frame | |
if (frameCount > 2) { | |
rotateY(i); | |
} | |
// Draw the image in the center | |
image(img,-img.width/2.0, -img.height/2.0); | |
popMatrix(); | |
// saveFrame("frame####"); | |
saveTransparentCanvas(BG, "img"); | |
i = i+(PI/8); | |
} | |
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("Frame"+frameCount+".png"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment