Daily Creative Coding

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

踊る三角形

/**
* Dancing Triangle
*
* @author aa_debdeb
* @date 2015/12/24
*/

PVector V1_CENTER, V2_CENTER, V3_CENTER;

void setup(){
  size(500, 500);
  smooth();
  frameRate(30);
  background(128);
  
}

void draw(){
  fill(128, 30);
  noStroke();
  rect(0, 0, width, height);
  
  fill(128, 0, 128);
  noStroke();
  PVector v1 = new PVector(250 + 125 * cos(frameCount * 0.15), 125 + 125 * sin(frameCount * 0.15));
  PVector v2 = new PVector(125 + 125 * cos(frameCount * -0.1), 375 + 125 * sin(frameCount * -0.1));
  PVector v3 = new PVector(375 + 125 * cos(frameCount * 0.25), 375 + 125 * sin(frameCount * 0.25));
  
  triangle(v1.x, v1.y, v2.x, v2.y, v3.x, v3.y);
}