Daily Creative Coding

元「30 min. Processing」。毎日、Creative Codingします。

リサージュ図形

/**
* Lissajous figure
*
* @author aa_debdeb
* @date 2016/03/09
*/

void setup(){
  size(500, 500);
  frameRate(180);
  background(0);
  stroke(255, 50);
  strokeWeight(1);
  
}

void draw(){
  float x = map(sin(frameCount * 0.0334435), -1, 1, 0, width);
  float y = map(sin(frameCount * 0.0552354), -1, 1, 0, height);
  float nx = map(sin((frameCount + 1) * 0.0334435), -1, 1, 0, width);
  float ny = map(sin((frameCount + 1) * 0.0552354), -1, 1, 0, height); 
 
  line(x, y, nx, ny); 
}