您的位置:首页 > 其它

Processing 练习(8)- 彩虹 - (HSB/Random/filter_BLUR)

2015-09-09 13:31 471 查看








/* - - - - - - - - - - -- - - - - - - - - - - - - - - - - -
程序功能:彩虹练习
- - - - - - - - - - -- - - - - - - - - - - - - - - - - - */
class MyCircle{
float R;
float px,py;
float speed_x,speed_y;
MyCircle(float temp_R,float temp_px,float temp_py,float temp_speed_x,float temp_speed_y){
R = temp_R;
px = temp_px;
py = temp_py;
speed_x = temp_speed_x;
speed_y = temp_speed_y;
}
void move(){
px += speed_x;
py += speed_y;
if(px > width || px < 0){
speed_x = -speed_x;
}
if(py > height || py < 0){
speed_y = -speed_y;
}
}
void display(){
fill(60);
ellipse(px,py,R,R);
fill(200);
ellipse(px,py,R*0.8,R*0.8);
}
}

MyCircle C1,C2;

// 定义变量;

void setup(){
size(360,202);
frameRate(50);
colorMode(HSB);
background(#529EDB);
stroke(255,0,0,100);
strokeWeight(0.3);
//
C1 = new MyCircle(60,width/2,height/2,4,0);
C2 = new MyCircle(80,width/2,height/2,0,-3);
}

void draw(){
strokeWeight(random(10,30));
stroke(random(255),188,200);
float rainbow_size = random(200,270);
translate(width/2,height/2);

noFill();
ellipse(0, 0.8*height,rainbow_size*1.5,rainbow_size*1.5);
filter(BLUR,4);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: