2016年3月24日 星期四

02161061_陳侑增, Week05

import java.awt.Frame;
PFrame f;
secondApplet s;
void setup() {
 size(320, 240);
 PFrame f = new PFrame();
}
void draw(){
  background(255,0,0);
   fill(255);
   rect(10,10,frameCount%100,10);
   s.background(0,0,255);
   s.fill(100);
   s.rect(10,20,frameCount%120,10);
   s.redraw();
}
public class PFrame extends Frame {
    public PFrame(){
        setBounds(100,100,400,300);
        s = new secondApplet();
        add(s);
        s.init();
        show();
    }
}
public class secondApplet extends PApplet{
    public void setup(){
        size(400,300);
        noLoop();
    }
    public void draw(){
    }
}
void setup(){
  size(500,500);
}
void draw(){
  float t= frameCount/180.0*PI;
  background(0);
  fill(255);
  ellipse(150,200,150,150);                      
  ellipse(500-150,200,150,150);
  fill(#FF0033);
  ellipse(150+15*cos(t),200+15*sin(t),50,50);            
  ellipse(500-150+15*cos(t),200+15*sin(t),50,50);
}

void setup(){
  size(600, 600);
}
void draw(){
  float t = frameCount/180.0*PI;
  background(255);
 for (float f=0; f<PI; f+=0.1){
   rect(200+150*cos(f+t),f*100,30,30);
   fill(#0041FF);
   rect(200+150*cos(f+t+PI),f*100,30,30);
   fill(#0041FF);
  }
}



沒有留言:

張貼留言