【发布时间】:2022-01-15 07:35:17
【问题描述】:
我有一个代码来绘制颜色,以便在圆形中创建径向渐变。知道它是从黑色到白色。如何切换颜色并使用其他值? 我试图为不同的颜色创建值,但它不起作用。 有谁知道该怎么做? 这是一段代码:
// function to draw the gradient
void desenhar_grad(float posX, float posY, int raio) {
pushStyle();
noStroke();
for (int r = raio; r > 0; r--) {
int tom = round(map(r, raio, 0, 255, 0)); // the last 2 values are the colours. first is the center, second is the exterior
fill(tom);
circle(posX, posY, r * 2);
}
popStyle();
}
【问题讨论】:
标签: java processing gradient