close

void setup(){
  size(400,400);
  background(125);
  smooth();
  noStroke();}


void draw(){
  //中心點 半徑 等分量
  spiral(width/2,height/2,width/4,12);
  }
 
  void spiral(int xc,int yc,int r,int n){
    for (int i=0; i<n ; i++){
   float x= xc+r*cos (2*PI/n*i);
   float y= yc+r*sin (2*PI/n*i);
    ellipse(x,y,10,10);
 }}

 

 

==================================

void setup(){
  size(800,800);
  smooth();
  noStroke();}


void draw(){
  //中心點XY 半徑R 等分量N
    background(125);
    spiral(height/2,width/2,width/4,36);

  }
 
void spiral(int xc,int yc,int r,int n){
   
    for (int i=0; i<n ; i++){
        for (int j=0; j<n ; j++){
    float x= xc+r*cos (2*PI/n*i);
    float y= yc+r*sin (2*PI/n*i);
   

    float a= x+50*cos (2*PI/n*j);
    float b= y+50*sin (2*PI/n*j);   
   
    fill(random(160,180),random(160,180),0);
    ellipse(a,b,5,5);
   
        }
 }}

arrow
arrow
    全站熱搜

    ARC 發表在 痞客邦 留言(0) 人氣()