(1)主題:antialias
(2)期末作品Q&A
2.
PVector [] star=new PVector[300];
void setup(){
size(800,600,P3D);
for(int i=0;i<300;i++){
star[i]=new PVector(random(200)-100,random(200)-100,random(200)-100);
}
}
float nowX=0,nowY=0,nowZ=0,dz=3;
void draw(){
background(0);
translate(width/2,height/2);
beginShape(POINTS);
stroke(255);
for(int i=0;i<300;i++){
vertex(star[i].x,star[i].y,star[i].z);
star[i].z+=dz;
if(star[i].z>300){
star[i].x=random(200)-100;
star[i].y=random(200)-100;
star[i].z=random(200)-100;
}
}
endShape();
nowZ++;
}
3.執行

4.
float gaussian(float x){
return 1/sqrt(2*PI)*exp(-0.5*x*x);
}
void setup(){
size(800,600);
}
void draw(){
background(0);
beginShape(POINTS);
for(int x=0;x<800;x++){
for(int y=0;y<600;y++){
stroke(color(1000*gaussian((x+y-600)/300)));
vertex(x,y);
}
}
endShape();
}
5.執行

沒有留言:
張貼留言