Manipulating SVG files
A great thing about Processing is that you don't always have to draw your own shapes. You can draw just about anything you want in a vector editing program, and export it as an SVG file to use in Processing.
Getting ready
The first thing you need to do is create an SVG file to use in your sketch. Processing supports SVG files made with Adobe Illustrator or Inkscape. Inkscape is an open source vector editor, so it might be useful if you don't have access to an expensive piece of software, such as Illustrator. You can download it at: http://inkscape.org/.
Create a new sketch and save it as manipulating_svg_files.pde
in your sketchbook. Save your SVG file in the data folder of your sketch. You can do this by dragging the SVG file on the Processing editor, just like you did in the recipe on working with images.
How to do it...
We'll start with declaring some PShape
objects and loading them inside the setup()
function. The snowFlake
variable is used to load your SVG file, the...