Simple Shapes
Within Bonsai’s path module are a selection of shape classes. Note that these are globally exposed and inherit from the Path class.
new Rect(x, y, width, height, [cornerRadius])(docs)new Arc(centerX, centerY, radius, startAngle, endAngle, isAntiClockwise)(docs)new Circle(centerX, centerY, radius)(docs)new Ellipse(centerX, centerY, radiusX, radiusY)(docs)new Polygon(centerX, centerY, radius, sides)(docs)new Star(centerX, centerY, radius, rays, factor)(docs)
var myShape = new Rect(10, 10, 100, 100);
myShape.fill('yellow');
myShape.stroke('#f00', 2);
myShape.addTo(stage);
For a more detailed overview and more details about the path module see the Paths Overview and the Path Module Documentation.