【发布时间】:2012-04-19 15:58:17
【问题描述】:
我想在每次运行程序时绘制一个从白色到黑色并在 2 t0 8 秒内完成的处理进度条。确切的时间应该是随机的,但在 2 到 8 秒之内。
我已经运行了条形图,每次运行程序时,我都需要帮助以使条形图在 2 到 8 秒之间的随机时间完成。我完全迷失了,因为这是一个 uni 任务,我只是在寻找 psedocode 让我开始。到目前为止我有这个
int a;
int k;
int strokeC;
boolean bar=true;
void setup (){
size(500,300);
background(255);
colorMode(RGB,255);
a = 130;
k= a;
strokeC = 255;
rectMode(CENTER);
noFill();
rect(width/2,height/2,250,30);
}
void draw(){
k++;
for(int i=a, s=strokeC; i<=k && s>15; i++, s-- ) {
stroke(s);
line(i,140,i,160);
}
}
【问题讨论】:
-
嘿,你应该使用
homework标签来处理这种事情;-)
标签: loops random progress-bar processing