I can set strokeWeight(x) but I can’t find a method to return the current weight.
1 Like
you can store it every time you use strokeWeight(x)
you can even write a function for this like
before setup()
: float currentStrokeWeight;
function:
void strokeWeightMy( float x) {
strokeWeight(x) ;
currentStrokeWeight=x;
}
1 Like
There’s no method for it but a field within the PGraphics class named strokeWeight:
Processing.GitHub.io/processing-javadocs/core/processing/core/PGraphics.html#strokeWeight
Access the PGraphics main canvas via PApplet::g field or PApplet::getGraphics() method:
Processing.GitHub.io/processing-javadocs/core/processing/core/PApplet.html#g
Processing.GitHub.io/processing-javadocs/core/processing/core/PApplet.html#getGraphics--
println(g.strokeWeight); // 1.0
strokeWeight(2.5);
println(getGraphics().strokeWeight); // 2.5
exit();
5 Likes
Thanks! Follow on question: g.strokeColor is just a single int, how do I get r/g/b/a which is also an option to stroke() ?