Changing vertex() color within beginShape()
in
Programming Questions
•
1 year ago
I want to vary the colour of the line along it's length. My code below produces lines with uniform colour. I assume it just uses the colour resulting from the first stroke().
Any way to do this with standard Processing rendering (apart from splitting into different shapes, which is too inefficient)?
- noFill();
- strokeWeight(1.f);
- beginShape();
- for(PVector pv : points) // Points is a LinkedList<PVector>.
- {
- stroke(random(1.f) * 255, random(1.f) * 255, random(1.f) * 255, 255);
- vertex(pv.x, pv.y);
- }
- endShape();
1