thoughts:
I wanted to make a series of simple animations with circles as a main theme. But ended up only making two. I wanted to try the blur effect too, but spent too much time figuring out how to export frames from p5 without randomly skipping any frames. But I just gave up. I think slowing down the frame rate might be a solution, although I haven't tried it. Apart from that, I had fun.
gif:
... void renderMyDesign (float percent) { float x1 = cos(percent*6*PI); float x2 = -cos(percent*6*PI); float z1 = sin(percent*6*PI); float z2 = -sin(percent*6*PI); noStroke(); background(0, 0, 200); translate(width/2, height/2); rotate(2*PI*percent); if (percent%(1/3f) < 1/6f) { fill(255); ellipse( map(x1, -1, 1, -160, 160), 0, 200+ map(z1, -1, 1, -80, 80), 200+ map(z1, -1, 1, -80, 80)); fill(0); ellipse( map(x2, -1, 1, -160, 160), 0, 200+ map(z2, -1, 1, -80, 80), 200+ map(z2, -1, 1, -80, 80)); } else { fill(0); ellipse( map(x2, -1, 1, -160, 160), 0, 200+ map(z2, -1, 1, -80, 80), 200+ map(z2, -1, 1, -80, 80)); fill(255); ellipse( map(x1, -1, 1, -160, 160), 0, 200+ map(z1, -1, 1, -80, 80), 200+ map(z1, -1, 1, -80, 80)); } } ... |
var frame = 0; var phase1 = 30; var phase2 = 50; var phase3 = 150; // start falling var phase4 = 160; var phase5 = 190; var SIZE = 120; var r = 255; var g = 255; var b = 255; var cnv; function setup() { cnv = createCanvas(640/2, 640/2); noStroke(); } function draw() { background(225, 0, 100); if (frame <= phase2) { translate(0, map(pennerEaseOutCubic(frame/phase2), 0, 1, -60/2, 520/2)); } // horizontal oscillation if (frame > phase1 && frame < phase4) { var osc = map(sin((frame-phase2)/PI*2), -1, 1, -50/2, 50/2); var oscScale = reverseSineEase(map(frame, phase1, phase4, 0, 2*PI)); translate(osc*oscScale, 0); // ellipse(width/2, 0, reverseSineEase(map(frame, phase1, phase4, SIZE, 400))); } if (frame > phase2 && frame <= phase3) { translate(0, map(pennerEaseInOutQuad((frame-phase2)/(phase3-phase2)), 0, 1, 520/2, 200/2)); SIZE += 1.5/2; } if (frame > phase3) { translate(0, map(pennerEaseInCubic((frame-phase3)/(phase5-phase3)), 0, 1, 200/2, 840/2)); } if (frame > phase2 + 20 && frame < phase4) { r -= 3.5; g -= 3.5; b -= 3.5; } fill(r, g, b); ellipse(width/2, 0, SIZE); frame++; if (frame>phase5) { frame=0; SIZE = 120; r=255; g=255; b=255; } } function pennerEaseOutCubic(t) { t = t-1.0; return (t*t*t + 1); } function pennerEaseInCubic(t) { return t*t*t; } function reverseSineEase(t) { return ((1-cos(t))/2)*((1-cos(t))/2); } function pennerEaseInOutQuad (t) { if ((t/=1/2) < 1) return 1/2*t*t; return -1/2 * ((--t)*(t-2) - 1); } |