您的位置:首页 > 其它

Processing 练习(10) - 条形码

2015-09-11 20:25 211 查看
float x = 0;

void setup() {
size(400, 400);
background(255);
stroke(255);
}

void draw() {
line(x, 200, x, 100);
x = x + 1;

if (x > width) {
x = 0;
}
// sometimes we decide to change the line color
if (random(100) > 70) {

// now we decide if to use black or white
if (random(100) > 50) {
stroke(0);
}
else {
stroke(255);
}

}
}
这段代码复制自fun programming. 用来让初学者理解随机数的使用。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: