18/1/2

/*
 * 2019/1/2
 */
float velocity = 0;
float acceleration = 0.05;

void setup() {
  size(640, 640, P3D);
  colorMode(HSB, 360, 100, 100, 100);
  frameRate(30);
}

void draw() {
  background(1);

  translate(width/2, height/2);
  rotateY(frameCount * 0.01);
  rotateX(frameCount * 0.01);

  float lastx = 0, lasty = 0, lastz = 0;
  float radius = 200;
  float s = 0, t = 0;

  while (s <= 180) {
    float radianS = radians(s);
    float radianT = radians(t);

    float x = radius * sin(radianS) * cos(radianT);
    float y = radius * sin(radianS) * sin(radianT);
    float z = radius * cos(radianS);

    stroke(100, 0, 100, 100);
    if (lastx != 0) {
      strokeWeight(1);
      line(x, y, z, lastx, lasty, lastz);
    }
    strokeWeight(10);
    point(x, y, z);

    lastx = x;
    lasty = y;
    lastz = z;

    s++;
    t += velocity;
  }
  velocity += acceleration;
}

void keyReleased() {
  if (key == 's' || key == 'S') saveFrame("frames/##.png");
}

f:id:heyassy:20190102225359p:plain

新年なので気持ちを昔に戻してなめサンの過去ブログを写経した