JavaScript Paths

Author:Oliver Steele
Copyright:Copyright 2006 Oliver Steele. All rights reserved.
License:MIT License (Open Source)
Homepage:http://osteele.com/sources/javascript
Docs:http://osteele.com/sources/javascript/docs/path
Download:http://osteele.com/sources/javascript/path.js
Example:http://osteele.com/sources/javascript/bezier-demo.php
Created:2006-02-20
Modified:2006-03-21

Usage:

  var path = new Path();
  path.addBezier([{x:0,y:0}, {x:50,y:50}, {x:100,y:25}]);
  path.addLine([{x:100,y:25}, {x:150,y:50}]);
  path.draw(context);
  var midpoint = path.atT(0.5);
  var length = 0.5 * path.measureLength();

Related

Also see path.js.