Skip to content

Instantly share code, notes, and snippets.

@iandioch
Created April 30, 2017 20:45
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save iandioch/84d0e2f482fea27140b13137f2987de0 to your computer and use it in GitHub Desktop.
rotatedog.pde
PImage dog;
final int NUM_DOGS = 5;
int iter = 0;
final int MAX_ITER = 64;
void setup(){
size(600, 600);
dog = loadImage("dog-mature-landing-hero.jpg");
}
void draw() {
background(255, 255, 255);
for (float i = 0; i < NUM_DOGS; i++) {
final float d = width/3.5; // dist from centre
float angle = (PI*2f)*(i/NUM_DOGS) + (TWO_PI/NUM_DOGS)*((iter+0f)/MAX_ITER);
pushMatrix();
translate(width/2 + cos(angle)*d, height/2 + sin(angle)*d);
rotate(-angle);
scale(0.35);
imageMode(CENTER);
image(dog, 0, 0);
popMatrix();
}
saveFrame();
iter ++;
if (iter == MAX_ITER) {
exit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment