Monthly Archives: September 2007

SVG Path Loader For AS3


[Full Source Code]

[This Code Is Outdated, Click Here To View The Most Recent Updates]

I was looking for a way to design simple vector paths for use in Papervision3D. At first I considered writing an interpreter for a CAD format such as DWG or DXF, but I ultimately decided I didn’t want to invest that much time and chose the XML based SVG format. After putting together a quick XML parser that read path tags and spit out black outlines I scrapped the whole thing in favor of using a regular expression to just pull out the path tags.

Doing a little more digging I stumbled upon Helen Triolo’s implementation of an SVG reader in AS2. I snagged some code out of her makeDrawCmds function in PathToArray.as file and added support for “t/T” as well as a stub for implementing the elliptical arc path element. Helen’s code for converting cubic bezier curves to quadratic relies upon a recursive function. For a little quicker parsing I substituted Timothee Groleau’s fixed midpoint conversion code.

To Do:

  • Add elliptical arc support
  • Add path transformation support

Rippling Flag

I created a basic Plane and applied a BitmapMaterial to it. Before each frame a sine wave is applied to the plane vertices.

Papervision3D & SoundMixer


A quick example of direct manipulation of Papervision3D Vertices. It uses the current audio wave or spectrum to set the vertices’s y-axis value.

[Full Source Code]