scaling svg/pshapes
in
Core Library Questions
•
2 years ago
Hello,
I have an svg file with outlines of different sections of a map of San Francisco that I would like to use in a sketch. I need to resize the whole map, but loading the shape and then resizing it doesn't seem to affect the child shapes.
Right now some code I am trying out looks like this:
It sort of looks like it's doing what I want: draws an outline of the map image, and colors in the shape with the id "mission" in black... except there is also a little tiny outline of the mission shape also drawn in the upper lefthand corner of the map. I figure this has something to do with the scale commands, but when I leave out the line
I just see the map outline with no shading in the mission. I was thinking there might be a gigantic shaded in version of the mission offscreen, and it does seem like adding that line puts a proportionally sized mission onscreen with shading, but then I also get the smaller outline in the left corner.
Can anyone point me in the right direction?
I have an svg file with outlines of different sections of a map of San Francisco that I would like to use in a sketch. I need to resize the whole map, but loading the shape and then resizing it doesn't seem to affect the child shapes.
Right now some code I am trying out looks like this:
- PShape sfmap;
PShape mission;
void setup() {
size(900, 900);
sfmap = loadShape("Brenda_FirstAttempt.svg");
sfmap.scale(.2);
mission = sfmap.getChild("mission");
mission.scale(.2);
smooth();
noLoop();
}
void draw() {
background(255);
sfmap.disableStyle();
shape(sfmap); - mission.disableStyle();
fill(0);
stroke(0);
shape(mission);
}
It sort of looks like it's doing what I want: draws an outline of the map image, and colors in the shape with the id "mission" in black... except there is also a little tiny outline of the mission shape also drawn in the upper lefthand corner of the map. I figure this has something to do with the scale commands, but when I leave out the line
- mission.scale(.2);
I just see the map outline with no shading in the mission. I was thinking there might be a gigantic shaded in version of the mission offscreen, and it does seem like adding that line puts a proportionally sized mission onscreen with shading, but then I also get the smaller outline in the left corner.
Can anyone point me in the right direction?
1