ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [processing] 피는 꽃 (flower)
    데모 2013.05.27 13:03

    
    int val = 50;
    void setup() {
      size(300, 500, OPENGL);
      frameRate(24);
    }
    void draw() {
      background(0xffffffff);
      translate(width/2, height/2, 0);
      strokeWeight(1);
      stroke(0, 0, 0, 255);
      scale(1);
      rotateX(map(mouseY, 0, height, 0.0, QUARTER_PI));
      rotateY(PI/9.0);
      fill(255,0,0,50);
      
      val = max(50, mouseX);
      for(float a=0;a<360;a=a+45){
        beginShape(TRIANGLE_FAN);
        vertex(0, 0, 0);
        bezierVertex(
        100*cos(a*PI/180), 100*sin(a*PI/180), 100 * (1.0 - map(val, 50, width, 0.0, 0.6)),
        150*cos((a+20)*PI/180)/(val/40), 150*sin((a+20)*PI/180)/(val/40), 150 * (1.0 - map(val, 50, width, 0.0, 0.6)),
        250*cos((a+40)*PI/180)/(val/50), 250*sin((a+40)*PI/180)/(val/50), 180 * (1.0 - map(val, 50, width, 0.0, 0.6)));
        
        bezierVertex(
        150*cos((a+60)*PI/180)/(val/40), 150*sin((a+60)*PI/180)/(val/40), 150 * (1.0 - map(val, 50, width, 0.0, 0.6)),
        100*cos((a+80)*PI/180), 100*sin((a+80)*PI/180), 100 * (1.0 - map(val, 50, width, 0.0, 0.6)),
        0, 0, 0);
        endShape(CLOSE);
      }
      
      beginShape();
      vertex(0,0,0);
      bezierVertex(5,5,-100,10,10,-200,10,10,-600);
      endShape();
      
    }
    

    댓글 0

Designed by Tistory.