![]() |
|
Navigation |
Synopsis A rectangular box.
Function
Description Draw a rectangular box using the properties
props .
An optional nested figure inner may be placed inside the box.
Examples Lets start with a box
b0 of given (minimal) dimensions:
b0 = box(size(150,50), fillColor("lightGray")); render(b0);that will display as: ![]() We can nest a new box b1 in box b0 as follows:
b1 = box(shrink(0.8), fillColor("green")); b0 = box(b1, size(150,50), fillColor("lightGray")); render(b0);The result is: ![]() Note that:
b1 in the top left corner of b0 :
b1 = box(shrink(0.8), align(0, 0), fillColor("green")); b0 = box(b1, size(150,50), fillColor("lightGray")); render(b0);The result is: ![]() Placing b1 in the bottom right corner of b0 :
b1 = box(shrink(0.8), align(1, 1), fillColor("green")); b0 = box(b1, size(150,50), fillColor("lightGray")); render(b0);gives: ![]() We can also nest box b0 in another box b2 and make b2 20% larger than b0 :
b0 = box(size(150,50), fillColor("lightGray")); b2 = box(b0, grow(1.2), fillColor("blue")); render(b2);The result is: ![]() If no sizes are given at all then the box will expand to fill the available size: render(box(box(box(box(shrink(0.5)),shrink(0.5)),shrink(0.5))));The result is: ![]() ![]() |