2014년 11월 14일 금요일

Heart Plot V0.1

Heart Plot V0.1









// Heart Plot V0.1
// 20141115
// by DongKim


Heart Heart1;
int pX=0;
int pY=0;
int pScale=10;

void setup() {
    size(640,480);
    background(255,230,200);
    smooth();
    frameRate(2);
    noStroke();
    fill(255,0,0);
    
    Heart1 = new Heart(this);
} 

void draw()
{
    background(255,230,200);
    pX=random(0,width);
    pY=random(0,height);
    pScale=random(1,10);

    pushMatrix();
    translate(pX,pY);
    rotate(random(0,2*PI));
    Heart1.Plot(pScale,random(200,255),random(0,200),random(0,200));
    popMatrix();

}

class Heart
{
    float scale;
    int R,G,B;
    
    void Heart()
    {
        scale=30.0;
        R=255;  G=0;  B=0;
    }
    
    void Plot(float temp_scale, int temp_R, int temp_G, int temp_B)
    {
        int i=0;
        float t=0.0;
        float x,y;
        
        scale=temp_scale;
        R=temp_R;  G=temp_G;  B=temp_G;

        fill(R,G,B);

        while (i<2000)
        {
            i++;
            t=t+(2*PI)/float(i);
            x=16*pow(sin(t),3);  x=scale*x;
            y=13*cos(t) - 5*cos(2*t) - 2*cos(3*t) - cos(4*t);  y=scale*y;
            ellipse(x,-y,1,1);
        }
    }
}





아... 잠이 안온다. 불안장애 같은건가.


댓글 없음:

댓글 쓰기