2011年8月28日 星期日

snake_Form (processing)


基本上使用 processing中的noise來形成圖形
透過點構成線的觀念
利用noise進行線段的弧線

Basically using the "noise" function to create the graphic.
Using the concept of line is composed by points and noise to
make the curve.

這是單一一支弧線
已經非原本點
而將點作為圓及方形的中心來畫圖

This is the single curve.
We use the point as the center of the ellipse and rectangle to 
make the form.


一直成功之後
開始複製多個不同曲度的弧線
Once we success. we try to populate 
curves with different curvature.



或增加不同間隔
or different step on Y direction.






and make them more dramatic







the code is below:
void setup(){
 size(1600,720); 
 //noLoop();//noLoop若開啟則會隨時間不停變化
}

void draw(){
   background(255);
   for(float j=0; j<=height; j+=20){
   ///ppp is the main function here, the random number control the curviture of the snake form  
   ////ppp為本程式主要方程式 後面亂數為決定蛇形圖形的擺盪程度
   ppp(360+random(1,-1)*j,random(-0.005,0.005));
   //360為視窗之中間 亦為起點 可更改
   //360 is the y of the starting point you can change it. 
   ppp(j,random(-0.005,0.005));
   //或是像這樣
   //or leave it like this
  }
}

void ppp(float j,float  NoiseScale){
  //基本上從點的觀念開始 
  //basic starting with the point concept, line is composed by points.
  //x方向逐一增加 step increment for the x direction
  //y方向則為擺盪 透過noise功能來改變 y using the noise to change the curve.
  for(int i =0; i<=width; i++){
   //ellipse(i,10,20,20);
   float n = j+map(noise(i* NoiseScale),0,1,-200,200);// make the noise number
   float k=1;
   k=k+n;

   //strokeWeight(5);
   noFill();
   stroke(i*k-255,0,0);
   //point(i,k);
   ellipse(i,k,k/20,k/20);
   rectMode(CENTER);
   stroke(0,0,k);    
   rect(i,k,2800/k,2800/k);
  }
}

沒有留言:

張貼留言