【发布时间】:2018-03-29 08:30:52
【问题描述】:
我做了一个简单的绘图程序来绘制线条并增加/减少线条的粗细:
float strokeWeight = 2;
void setup() {
size(640, 360);
noSmooth();
fill(126);
background(255);
strokeWeight(strokeWeight);
}
void draw() {
background(0);
ellipse(mouseX, mouseY, strokeWeight/2, strokeWeight/2);
background(255);
if (mousePressed) {
stroke(0);
line(mouseX, mouseY, pmouseX, pmouseY);
}
if (keyPressed) {
if (key == '+') {
strokeWeight = strokeWeight + 0.5;
}
if (key == '-') {
strokeWeight = strokeWeight - 0.5;
}
if (strokeWeight >= 0.5) {
strokeWeight(strokeWeight);
}
}
}
现在我想用光标移动一个圆圈,指示当前线条的粗细。我试过这样的事情:
ellipse(mouseX, mouseY, strokeWeight/2, strokeWeight/2)
但是这种方式会一遍又一遍地绘制椭圆。有没有办法“抹掉”之前做的圈子?
【问题讨论】:
标签: processing