0.0.2 • Published 7 years ago
fantasy-path v0.0.2
fantasy-path
Fantasy Land types for operating with vector paths, compatible with SVG and Canvas.
Work in progress
// TODO!
- Make MoveTo and LineTo use Point when constructing, for consistency with CubicBezierCurve
Types
Context2dTask: Task for drawing to a context2dfromContext2d(context2d)
Point(x, y):mapX(f)mapY(f)toD() -> StringtoJSON() -> Object structure
PathCommand:- Constructors
MoveTo(x, y)LineTo(x, y)CubicBezierCurve(point1, point2, point3)ClosePath()
- Methods
mapX(f)mapY(f)map(f)toD() -> StringgetContext2dTaskFor(context2d) -> Context2dTaskmatch(matcherOnDataConstructors)toJSON() -> Object structure
- Constructors
Path(...commands)map(f)toD() -> StringgetContext2dTaskFor(context2d) -> Context2dTaskmapX(f)mapY(f)concat(otherPath)strictDiffWith(otherPath) -> Result Path StringtoJSON() -> Object structure.empty() -> Path.fromD(d) -> Result Path String