- Web page can hold multiple Figures, each tied to a canvas.
<canvas id=canv1></canvas>
fig = new Figure("canv1")
- Graphical objects created declaratively using builder pattern:
with (fig) {
s = square().setFillStyle("yellow").setLineWidth(3)
- Graphical objects introduce variables for their position:
- .x() : x position (min/max: .x0(), .x1()
- .y() : y position (min/max: .y0(), .y1()
- .w() : width, .h() : height
- Variable values determined by solving constraints:
equal(s.w(), 150) // w = 150
equal(s.x0(), s.w()) // x0 = w
equal(s.y0(), times(2, s.h())) // y0 = 2*h
- Convenience methods for alignment constraints, etc.
let t = ellipse().setFillStyle("#8f8")
align("abut", "top bottom", s, hspace(100), t)
align("right", "none", t, canvasRect()) // t.x1 == canvas.x1