/* Built with Hope */ PImage pic; Phasor phasor; float rx = 0.375; float ry = 0.375; float rs = 0.25; float rsi = 1 / rs; void setup() { size(200, 200); smooth(); pic = loadImage("hope.png"); phasor = new Phasor(0.01); noCursor(); } void draw() { float c = phasor.next() + 1.0; c = pow(rsi, c) * 0.5; float w = width * c * rsi; float h = height * c * rsi; float offset = 1 / (1 - rs); float x = 0 - (w - width) * (rx * offset); float y = 0 - (h - height) * (ry * offset); progress(x, y, w, h, rx, ry, rs); } void progress(float x0, float y0, float w, float h, float rx, float ry, float rs) { image(pic, x0, y0, w, h); if (w > 1) { progress(x0 + w * rx, y0 + h * ry, w * rs, h * rs, rx, ry, rs); } } class Phasor { float phase = 0; float increment; Phasor(float inc) { increment = inc; } float next() { phase += increment; if (phase >= 1.0) { phase -= 1.0; } if (phase < 0) { phase += 1.0; } return phase; } }