2020年3月27日 星期五

week4


PImage imgBG;
int []x={0,0,0,0,0};
int []y={0,0,0,0,0};
int n=0;
void setup(){
  size(174,290);
  imgBG=loadImage("background.jpg");
}
void draw(){
  background(imgBG);
  for(int i=0;i<5;i++){
    circle(x[i], y[i], 40);
  }
}
void mousePressed(){
  if(n>=5) return;
  x[n]=mouseX;
  y[n]=mouseY;
  n++;
}

PImage imgBG;
int []x={0,0,0,0,0};
int []y={0,0,0,0,0};
int n=0;
void setup(){
  size(174,290);
  imgBG=loadImage("background.jpg");
}
void draw(){
  background(imgBG);
  for(int i=0;i<5;i++){
    circle(x[i], y[i], 40);
  }
}
void mousePressed(){
  if(n>=5) return;
  x[n]=mouseX;
  y[n]=mouseY;
  n=(n+1)%5;
}

int []a={1,1,1,0};
size(400,100);
for(int i=0;i<4;i++){
  if(a[i]==1) fill(255,0,0);
  else fill(128);
  rect( i*100, 0, 100,100);
}

沒有留言:

張貼留言