Skip to content

llenodo/path.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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/

About

A simple 2D SVG "Path" constructor with no external dependencies

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published