pakt00
See /f0blog/pact-februari/
//pakt00 ok - but missing lines from center to start of arc
int index;
PGraphics grad;
void setup() {
size(640, 480, JAVA2D);
frameRate(60);
noFill();
strokeWeight(1);
smooth();
index= 0;
grad= createGraphics(width, height, JAVA2D);
grad.beginDraw();
grad.background(0);
createGradient(grad, width*0.5, height*0.5, width*2.0, color(255.0, 255.0, 0.8*255.0), color(0, 0, 0));
grad.endDraw();
}
void draw() {
float x= width*0.5;
float y= height*0.5;
float w= width*0.25;
float h= height*0.25;
image(grad, 0, 0);
stroke(255.0, 255.0, 0.8*255.0);
for (int i= 0; i<120; i++) {
float start= sin((index+i)*0.006+i)*PI;
float end= sin((index+i)*0.0123+i)*TWO_PI;
if (start<end) {
float r= sin(index*0.01+i)*70.0+75.0;
arc(x, y, r*2.0, r*2.0, start, end);
} else {
float r= sin(index*0.01+i)*50.0+55.0;
arc(x+(sin(i*0.21)*w), y+(cos(i*0.2)*h), r*2.0, r*2.0, end, start);
}
}
index++;
}
void createGradient(PGraphics ctx, float x, float y, float radius, color c1, color c2) {
ctx.noStroke();
for (float r= radius; r>=0.0; r--) {
color col= lerpColor(c1, c2, r/radius);
ctx.fill(col);
ctx.ellipse(x, y, r, r);
}
}