/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.68G-oz3BZwZ/rev.3
*
* authors:
* GoToLoop
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
/**
* Pulsating Spiral Flower (v3.0)
* by Kevin (2014/Apr)
* mod GoToLoop
*
* forum.processing.org/two/discussion/4266/
* how-to-create-a-pulsating-particle-system-that-is-being-built
*
* studio.processingtogether.com/sp/pad/export/ro.90WsCogc75rxf/latest
*/
static final int GAP = 020, RAD = 3;
static final float EIGHTH_PI = QUARTER_PI/2.0;
final float ang = PI*(3 - sqrt(5));
void setup() {
size(500, 500, JAVA2D);
frameRate(60);
smooth(4);
noStroke();
ellipseMode(CENTER);
}
void draw() {
background(-1);
translate(width>>1, height>>1);
circles();
}
void circles() {
final float t = .1*THIRD_PI*frameCount;
for (int n = frameCount*3; n-- != 1;) {
float r = .25*GAP*sqrt(n);
float theta = n*ang;
float pulse = 6.0 + RAD*sin(t - n*EIGHTH_PI);
fill(0100, map(r*2.0, 0, width, 0, 0400), 0220, 0200);
ellipse(r*cos(theta), r*sin(theta), pulse, pulse);
}
}