We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Learning Bezier curves I came out with the, now popular, Bezier conector used in data visualizations,
PVector a1, a2, c1, c2;
void setup() {
size(400, 400);
background(255);
a1 = new PVector(0, random(height));
a2 = new PVector(width, random(height));
c1 = new PVector(width/2, a1.y);
c2 = new PVector(width/2, a2.y);
strokeWeight(3);
stroke(255, 0, 0);
bezier(a1.x, a1.y, //point 1
c1.x, c1.y, //ctrl 1
c2.x, c2.y, //ctrl 2
a2.x, a2.y); //point 2
}
Is it possible to set different strokeWeight values to endpoints in a Bezier curve? So that, something that starts with strokeWeight(3)
, ends with strokeWeight(16)
. I might be wrong and actually there's another way to achieve that.
Answers
I am fairly confident there is no direct way of doing this in Processing. The solution is to take charge of drawing the bezier curve yourself and changing the stroke weight as you go.
The code below does this - increase
steps
to improve smoothness.thanks quark, not so smooth but that's look better. I forgot about bezierPoint()