[Julius Tarng] Recreating John Whitney

Original

Recreation




Code walkthrough


Iterations

Preview
Notes
No idea what I was doing at this point, I think using sin/cos to draw random curves
Trying and failing to draw a circle, getting tripped up by the maths

Finally got the circle to work thanks to Peter/Zach/Lisa J

First goal is to recreate this part
Using an ofPath, I use slide to incrementally shift each vertex over as it’s drawn

  int ct = 36;
  for (int i = 0; i < ct; i++) {
    float r = 300;
    float prg = (float)i/((float)ct-1.f); // double up on first point
    float angle = TWO_PI*prg;
    float slide = fmod(ofGetElapsedTimef(), 2.f) * 400;
    float x = 400 + r * -cos(angle) + prg*slide;
    float y = 400 + r * sin(angle);
    l.lineTo(x,y);
    ofDrawCircle(x, y, 5);
  }

  l.close();
  l.draw();
Realizing cos/sin of an angle of 0 starts on the right 

  int ct = 36;
  for (int i = 0; i < ct; i++) {
    float r = 300;
    float prg = (float)i/((float)ct-1.f); // double up on first point
    float angle = TWO_PI*prg + PI/2.;
    float slide = fmod(ofGetElapsedTimef(), 2.f) * 400;
    float x = 400 + r * -cos(angle) + prg*slide;
    float y = 400 + r * sin(angle);
    l.lineTo(x,y);
    ofDrawCircle(x, y, 5);
  }

  l.close();