
void setup() {
size(640, 640);
background(0);
}
void draw() {
fill(0,1);
rect(0,0,width,height);//創建有透明度的渲染背景
float x=randomGaussian();//從均值為0且標準偏差為1的亂數字序列中回傳一個浮點數。
float y=randomGaussian();
//float r=randomGaussian();
//float b=randomGaussian();
//float g=randomGaussian();
float r=random(0,255);
float b=random(0,255);
float g=random(0,255);
float sd=60;//標準差
float mean=320;//平均值
//r=constrain(r*sd+mean,0,255);//constrain函式將值限定再最小值和最大值之間
//b=constrain(b*sd+mean,0,255);
//g=constrain(g*sd+mean,0,255);
x=x * sd + mean;
y=y * sd + mean;
noStroke();
fill(r,b,g,200);
ellipse(x,y,16,16);
}
代碼本色的練習題,小弟剛剛開始學processing
想問下有沒有方法可以實作逐漸消失的效果?
下面這些畫完以后就留在背景上了,可不可以讓它們逐漸消失掉?
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/211314.html
標籤:Java相關

