Created
April 30, 2017 20:45
-
-
Save iandioch/84d0e2f482fea27140b13137f2987de0 to your computer and use it in GitHub Desktop.
rotatedog.pde
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 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