2012年9月25日 星期二

Week03 HW03 葉正聖老師

http://www.youtube.com/watch?v=I3hfmVb1IQs

size(600,600);

fill(255,255,255);
rect(100,100,100,100);


fill(255,255,0);
ellipse(100,100,100,100);

for(int i=0;i<10;i++){

}

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

void setup(){
  size(600,600);
}

void draw(){
  fill(255,255,255);
  rect(100,100,100,100);

  fill(255,255,0);
  ellipse(mouseX,mouseY,100,100);
}

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

void setup(){
  size(600,600);
  //frameRate(1);
}
float x=100,y=100;
void draw(){
  background(0,0,0);

  fill(255,255,255);
  ellipse(mouseX,mouseY,100,100);

  fill(255,255,0);
  ellipse(x,y,50,50);

  x=x*0.9 + mouseX*0.1;
  y=y*0.9 + mouseY*0.1;
}

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

void setup(){
  size(600,600);
}
float [] x = new float[10];
float [] y = new float[10];
void draw(){
  background(0,0,0);
  fill(0,0,255);
  ellipse(mouseX,mouseY,50,50);
  fill(255,255,255);

  x[9]=mouseX;
  y[9]=mouseY;
  for(int i=0;i<9;i++){
    ellipse(x[i],y[i],20,20);
    x[i]=x[i+1];
    y[i]=y[i+1];
  }
}

========

void setup()
{
  size(600,600);
}
void draw()
{
  background(0,0,0);
  fill(255,255,255);
  ellipse(200,200, 200,200);
  ellipse(400,200, 200,200);
 
  fill(0,0,100);
  float x=mouseX-200, y=mouseY-200;
  float len=sqrt(x*x+y*y);
  ellipse(200+x*50/len,200+y*50/len, 100,100);

  x=mouseX-400;
  y=mouseY-200;
  len=sqrt(x*x+y*y);
  ellipse(400+x*50/len,200+y*50/len, 100,100);
}

沒有留言:

張貼留言