Uneven stroke weight when scaling PShape?
in
Programming Questions
•
1 year ago
So I've been using illustrator SVGs to do the graphics for my project since I figured PShape's ability to scale vectors would give a huge advantage over scaling and skewing PNGs. Unfortunately, the outlines don't seem to be scaling evenly.
Here's an example of my project sizing the shape directly
- //width is tracked by the PVector mSize and the shape is scaled while drawn
- //yoffset is height adjustment for the animation
- shape(body, mPosition.x, mPosition.y-(yoffset/2), mSize.x, mSize.y+yoffset);
Here's an example of using PShape's scale function. Tested using the example in Processing's example book
- void draw() {
- background(102);
- translate(width/2, height/2);
- float zoom = map(mouseX, 0, width, 0.1, 4.5);
- bot.disableStyle();
- scale(zoom, 1);
- stroke(0);
- strokeWeight(8);
- shape(bot, -140, -140);
- }
If you follow the outline, you can see where it thins and thickens. It seems to me like the stroke is being applied before the shape is scaled. Is there a way to scale the vector itself and THEN apply the stroke so that it will be even? Really appreciate any help, thanks! :)
1