小编Sam*_*del的帖子

如何在贝塞尔曲线中添加渐变?

我在地图上绘制了表示客户国家和他要去旅行的国家的曲线。 在此处输入图片说明

但是我无法添加渐变,以便线条表示所述信息并在两种颜色之间随机给出这种随机颜色。这是我尝试过的。

int steps = 10;
    noFill();
    //stroke(#5A38FA, 50);
    strokeWeight(1);
    for(int i=0; i<steps; i++) {
      strokeWeight(1);
      noFill();
      stroke(lerpColor(#31B5E8, #F0E62E, (float)i/steps));
      bezier(locationX, locationY, locationX+random(15, 50), locationY+random(13,50), customerLocationX+random(15, 30), customerLocationY+random(15, 70), customerLocationX, customerLocationY);
    }
Run Code Online (Sandbox Code Playgroud)

processing

7
推荐指数
1
解决办法
220
查看次数

标签 统计

processing ×1