uxebu/bonsai — pull request #9 by padolsey (2012-07-24 09:36:21+00:00)
Title: Path special-classes (plus renaming `Shape` to `Path`)

* Replaces the `Shape` class with the `Path` class.
* Introduces new classes for all shape types, namely:
* Polygon
* Ellipse
* Circle
* Rect
* Star
* Arc

`Path.*` factories still exist, but don't return their special path class instances. In other words, `Path.rect()` will just return a `Path` instance (like before), not a `Rect` instance. This is to retain previous functionality, most significantly shape-morphing ([see this](https://github.com/uxebu/bonsai/commit/4877991e61051da039daf3ad757ecda66ae1eeb0)).

All special path classes (Arc, Rect etc.) inherit from `SpecialPath`. SpecialPath directly subclasses Path and provides a convenience argument for adding special attributes for unique shape types. See the implementations of `Rect`, `Arc` (etc.) for demonstrations of this convenience argument. In addition `SpecialPath` removes the `morphTo` method ([see this](https://github.com/uxebu/bonsai/commit/4877991e61051da039daf3ad757ecda66ae1eeb0)) and makes sure the path is redrawn (using the `_make` method) when attributes are changed (e.g. when `radius` is changed on a `Circle` instance).

Individual path classes each have their applicable properties as regular bonsai attributes. So you can do stuff like:

```js
new Rect(0,0,100,100).addTo(stage).animate('1s', {
width: 200,
height: 200,
cornerRadius: 20
});
new Star(100, 100, 50, 5, 2)
.attr({ rays: 16 })
.fill('blue')
.addTo(stage)
.animate('1s', {
factor: 1
});
```

Overview of new special attributes:

* `Rect`: width, height, cornerRadius
* `Star`: radius, rays, factor
* `Circle`: radius
* `Ellipse`: radiusX, radiusY
* `Polygon`: radius, sides
* `Arc`: radius, startAngle, endAngle, antiClockwise