我正在尝试更改各个点的alpha值。我使用stroke()方法设置了一个alpha值,我尝试了其他方法,比如使用fill()设置它,即使这并不适用于点,但我仍然无法更改alpha值。 / p>
重现的步骤: 这是一个简短的代码示例。两条红线。一个具有默认的alpha(255),一个具有alpha = 100。我有一条蓝线与alpha = 100交叉。
void setup()
{
size(500, 500);
background(255);
colorMode(RGB);
smooth();
}
void draw() {
int x = 250;
int y = 250;
int alphaval = 100;
strokeWeight(5);
for (int del = 0; del < 100; del = del+1) {
stroke(255, 0, 0);
point(x-20-del/2, y-del/2);
}
for (int del = 0; del < 100; del = del+1) {
stroke(255, 0, 0, alphaval);
point(x-del/2, y-del/2);
}
for (int del = 0; del < 100; del = del+1) {
stroke(0, 0, 255, alphaval);
point(x-60+del/2, y-del/2);
}
}
答案 0 :(得分:1)
void setup()
{
size(500, 500);
background(255);
colorMode(RGB);
smooth();
}
void draw() {
background(255);
int x = 250;
int y = 250;
int alphaval = 10;
strokeWeight(20);
for (int del = 0; del < 100; del = del+1) {
stroke(255, 0, 0);
point(x-30-del/2, y-del/2);
}
for (int del = 0; del < 100; del = del+1) {
stroke(255, 0, 0, alphaval);
point(x-del/2, y-del/2);
}
for (int del = 0; del < 100; del = del+1) {
stroke(0, 0, 255, alphaval);
point(x-60+del/2, y-del/2);
}
}