draw() 中的随机笔划权重总是更大 - 处理
Random stroke weight is always bigger in draw() - Processing
我正在尝试使用随机笔划绘制三角形 weight.The 问题是笔划粗细仅在新值大于旧值时才会改变。这是我试过的。不知道是应该重绘还是刷新draw void底部的显示
void setup() {
size(600, 800);
frameRate(7);
background(137, 156, 199);
} // Acaba void setup
void draw() {
// RANDOM WEIGHT TRIANGLE
noFill();
stroke(225, 225, 225);
strokeWeight(random(20)); // DOESN'T CHANGE PROPERLY
triangle(580, 780, 580, 750, 500, 780);
}
background
does not only set the background color, it actually clears the background. You have to clear the background in every frame (in draw
):
void draw(){
background(137, 156, 199);
// [...]
}
图像并没有在 draw()
方法的每个循环中神奇地消失,这就是为什么您看不到三角形的线宽何时比以前低的原因。你需要重新粉刷所有东西才能让它变得引人注目。
这很好,因为它真的很容易做到。在 draw()
方法中移动此行 background(137, 156, 199);
作为您做的第一件事。在此之后,绘图应该会如您所愿:
玩得开心!
我正在尝试使用随机笔划绘制三角形 weight.The 问题是笔划粗细仅在新值大于旧值时才会改变。这是我试过的。不知道是应该重绘还是刷新draw void底部的显示
void setup() {
size(600, 800);
frameRate(7);
background(137, 156, 199);
} // Acaba void setup
void draw() {
// RANDOM WEIGHT TRIANGLE
noFill();
stroke(225, 225, 225);
strokeWeight(random(20)); // DOESN'T CHANGE PROPERLY
triangle(580, 780, 580, 750, 500, 780);
}
background
does not only set the background color, it actually clears the background. You have to clear the background in every frame (in draw
):
void draw(){
background(137, 156, 199);
// [...]
}
图像并没有在 draw()
方法的每个循环中神奇地消失,这就是为什么您看不到三角形的线宽何时比以前低的原因。你需要重新粉刷所有东西才能让它变得引人注目。
这很好,因为它真的很容易做到。在 draw()
方法中移动此行 background(137, 156, 199);
作为您做的第一件事。在此之后,绘图应该会如您所愿:
玩得开心!