Skip to content

Instantly share code, notes, and snippets.

@wonderburg7
Last active December 15, 2018 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wonderburg7/76b464d29956b2a9831e5b00955a68cb to your computer and use it in GitHub Desktop.
Save wonderburg7/76b464d29956b2a9831e5b00955a68cb to your computer and use it in GitHub Desktop.
PImage img1, img2, img3;
int rotationCount = 0;
static final color BG = -4;
int picSize;
void setup() {
size(500, 500);
// noSmooth();
// ((PGraphicsOpenGL)g).textureSampling(2);
img1 = loadImage("https://i.ibb.co/KXbnGm4/Psychic-Sally.png");
img2 = loadImage("https://i.ibb.co/n1DrLxJ/Psychic-waves.png");
imageMode(CENTER);
picSize = height;
// img1.resize(picSize, picSize);
// img2.resize(picSize, picSize);
}
void draw() {
//background(BG);
background(0, 0);
picSize = height;
translate(width/2, height/2);
image(img1,0,0, picSize, picSize);
pushMatrix();
rotate(radians(rotationCount));
image(img2,0,0, picSize, picSize);
popMatrix();
rotationCount++;
//saveTransparentCanvas(BG, "img");
if (rotationCount == 360){
rotationCount = 0;
}
}
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("Psychic Sall frame "+frameCount+".png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment