-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
7 lines (4 loc) · 822 Bytes
/
README
File metadata and controls
7 lines (4 loc) · 822 Bytes
1
2
3
4
5
6
7
A 2D SVG path constructor with no external dependencies.
Without using any external libraries, create a 2D "Path" constructor in JavaScript that accepts either an array of points (which are arrays themselves of length two) or a subset of an SVG path string (see http://www.w3.org/TR/SVG/paths.html), where only the moveto, closepath and lineto commands are accepted. The path must be connected, so the moveto command must only appear at the beginning and the closepath may optionally appear only at the end. The lineto must accept both absolute and relative integer coordinates.
The Path objects must inherit from Arrays, so all array methods should work on Pathobjects. This means that new Path instanceof Path and new Path instanceof Array must both return true.
See live demo at http://llenodo.github.com/path.js/