Blob Blame Raw

#include <math.h>
#include <helianthus.h>


void init() {
}


void put(double level) {
  double x = level;
  double e = exp(1+level);
  double l = log(1+level);

  double angle  = l*360*4;
  double dist   = x*2;
  double radius = (1-l)*0.2;

  int cnt = 2;

  saveState();
  rotate(angle);
  for(int i = 0; i < cnt; ++i) {
    rotate(360.0/cnt);
    saveState();
    translate(dist, 0);
    circle(0, 0, radius);
    restoreState();
  }
  restoreState();
}


void draw() {
  double w = windowGetWidth();
  double h = windowGetHeight();

  saveState();
  noStroke();
  fill(COLOR_BLACK);
  translate(w/2, h/2);
  zoom(100);

  int cnt = 100;
  for(int i = 0; i < cnt; ++i)
    put((i+1)/(double)cnt);

  restoreState();
}


int main() {
  windowSetResizable(TRUE);
  windowSetVariableFrameRate();
  windowSetInit(&init);
  windowSetDraw(&draw);
  windowRun();
  return 0;
}