Simple rotation
in
Programming Questions
•
1 year ago
I am trying to create a simple rotation where to ellipse shaped images share the center and rotate in the opposite direction. I've moved the code around but I can't seem to overlap the two. One just seems to rotate along the outside of the other.
Any suggestions would be greatly appreciated.
- float count;
- PImage img;
- PImage img2;
- void setup()
- {
- count = 0;
- size(400,400);
- //load the images
- img=loadImage("frame-0001.png");
- img2=loadImage("frame-0002.png");
- }
- void draw()
- {
- count++;
- background(255);
- translate(width/2, height/2);
- rotate(-0.5*count*TWO_PI/360);
- translate(-img.width/2, -img.height/2);
- image(img2,0,0);
- translate(width/2, height/2);
- rotate(1.0*count*TWO_PI/360);
- translate(-img.width/2, -img.height/2);
- image(img,0,0);
- }
1