使用背景不透明度值的 Fading CurveVertex() trails 不起作用

Fading CurveVertex() trails using background opacity value not working

使用 FX2D。

您好,我目前正在使用 curveVertex() 函数在每一帧绘制一条线。 每一步都不会重置背景,每条线都会自动留在草图上, 留下痕迹效果。

但我想让这些足迹随着时间的推移逐渐消失。我尝试通过给它一个小的不透明度值来重置 draw() 函数中的背景,但它每次都会立即清除所有轨迹。

现在我只能有所有轨迹或没有轨迹。

  //background(0, 0, 0, 10); // Reset background every time
  stroke(255, 255, 255, 10); // Draw Line between all nodes
  curveVertex(nodes.get(fixId(i)).position.x, nodes.get(fixId(i)).position.y);

with trails

background() does not just set the background color, it clear the entire window. It is not intended to use background within beginShape() / endShape() 个序列。

在框架的开始处,在整个window上画一个rect() with blendMode(DIFFERENCE)可以实现什么。例如:

void draw() {

    // "fade" the entire view 
    blendMode(DIFFERENCE);
    fill(1, 1, 1, 255);
    rect(0, 0, width, height);

    blendMode(ADD);

    // draw shape
    // [...]

}

另请参阅 的答案。