pakt00
See /software/p5js/pakt-februari/pakt00/ for a JavaScript version and /software/supercollider/februari-pakt/pakt00/ for accompanying sound code.
#include "cinder/app/App.h"
#include "cinder/cairo/Cairo.h"
using namespace ci;
using namespace ci::app;
using namespace std;
const int WIDTH= 640;
const int HEIGHT= 480;
class pakt00App : public App {
public:
void setup();
void draw();
int index;
};
void pakt00App::setup() {
index= 0;
}
void pakt00App::draw() {
float x= getWindowCenter().x;
float y= getWindowCenter().y;
float w= getWindowWidth()*0.25;
float h= getWindowHeight()*0.25;
cairo::Context ctx( cairo::createWindowSurface() );
cairo::GradientRadial radialGrad(getWindowCenter(), 0, getWindowCenter(), getWindowWidth());
radialGrad.addColorStop(0, Color( 1, 1, 0.8));
radialGrad.addColorStop(1, Color( 0, 0, 0));
ctx.setSource(radialGrad);
ctx.paint();
ctx.setLineWidth(1);
ctx.setSourceRgba(1, 1, 0.8, 1);
for(int i= 0; i<120; i++) {
float start= sin((index+i)*0.006+i)*M_PI;
float end= sin((index+i)*0.0123+i)*2*M_PI;
if(start<end) {
ctx.arc(x, y, sin(index*0.01+i)*70+75, start, end);
} else {
ctx.arc(x+(sin(i*0.21)*w), y+(cos(i*0.2)*h), sin(index*0.01+i)*50+55, end, start);
}
}
ctx.stroke();
index++;
}
CINDER_APP(pakt00App, Renderer2d, [&]( App::Settings *settings ) {
settings->setWindowSize( WIDTH, HEIGHT );
settings->setResizable( false );
})