Processing 练习(5)- Random bubbles fade out!!

来源:互联网 发布:淘宝先锋ss商家入口 编辑:程序博客网 时间:2024/06/04 21:22

代码:

int t = 0; void setup(){  size(500, 500);  noStroke();  smooth();  background(0);   frameRate(60);} void draw(){      fill(0, 1);  rect(0, 0, width, height);  // 通过不断叠加半透明的黑色矩形,使得所画图像不断变暗;  if(t == 10){  // That's evey two seconds, 每到两秒触发画图。    popUpBubble();    t = 0;  } else {    t += 1;  }} void popUpBubble(){  float diameter = random(1) * 195 + 5;  float radious = diameter / 2.0;  float x = random(width - radious);  float y = random(height - radious);  fill(  255 * random(0,1),  255 * random(0,1),  255 * random(0,1),100  );  arc(x, y, diameter, diameter, 0.0, PI*2);}





-----

0 0
原创粉丝点击