mouse over GetChild in PShape
in
Core Library Questions
•
1 year ago
hello,
i have looked into the example of coloring the US map by using the GetChild command. i would like to do the same exercise but I want to color the child only when the mouse goes above it. i am wondering if anyone has any suggestions on how this could be done? the code is below.
many thanks!
i have looked into the example of coloring the US map by using the GetChild command. i would like to do the same exercise but I want to color the child only when the mouse goes above it. i am wondering if anyone has any suggestions on how this could be done? the code is below.
many thanks!
PShape usa; PShape michigan; PShape ohio; void setup() { size(640, 360); usa = loadShape("usa-wikipedia.svg"); michigan = usa.getChild("MI"); ohio = usa.getChild("OH"); smooth(); // Improves the drawing quality of the SVG noLoop(); } void draw() { background(255); // Draw the full map shape(usa, -600, -180); // Disable the colors found in the SVG file michigan.disableStyle(); // Set our own coloring fill(0, 51, 102); noStroke(); // Draw a single state shape(michigan, -600, -180); // Go Blue! // Disable the colors found in the SVG file ohio.disableStyle(); // Set our own coloring fill(153, 0, 0); noStroke(); // Draw a single state shape(ohio, -600, -180); // Boo Buckeyes! }
1