Rotaing images

see a nice example online at: https://www.openprocessing.org/sketch/390536/

Animation_011

Code available on Github

/*
Rupert Russell
14 July 2018
MIT Licence

This program uses 2 images the background image is rotated behind the foreground image.
// https://www.technokids.com/blog/apps/wrap-text-along-a-shape-path-using-photoshop-cc/
*/

PImage fg;
PImage bg;

float deg = 0;
float step = 1; // the smaller the increment the slower & smoother the animation
float frames = 0;
float framesToGo = 0;

void setup() {
size(512, 512);
fg = loadImage("inner.png");
bg = loadImage("outer.png");
frames = 360 / step;
}

void draw() {
// move the origin to the center of the screen
translate(width/2, height/2);
rotate(radians(deg));

// load both images background first
image(bg, -width/2, -height/2); // load background

// note that I am rotating backwarads using "- deg" before loading the fg image to keep it from turning.
// - deg * 2 to rotate backwards
rotate(radians(- deg * 2));
image(fg, -width/2, -height/2); // load foreground

deg = deg + step;
framesToGo = frames - frameCount;

saveFrame("frame-######.png");
println("Frames to go = " + framesToGo);
if(frameCount > (360 / step)){
exit();
}
}