Context Free Art
Contents |
There are two categories of shape adjustments: geometric and color. Anywhere that you see num there can either be a numeric constant or a constant expression.
The geometry of shapes is defined by a two dimensional affine transform which is represented internally as a matrix.
| Adjustment | Meaning | Notes |
|---|---|---|
| x num | translation along the x-axis by num | |
| y num | translation along the y-axis by num | |
| z num | translation along the z-axis by num | The z-axis position determines which shape is on top when they overlap. The z-axis position is not stored in the affine transform matrix and does not affect the shape of objects. |
| size num or s num | scale in x and y by num | |
| size num1 num2 or s num1 num2 | scale in x by num1 and in y by num2 | |
| size num1 num2 num3 or s num1 num2 num3 | scale in x by num1, in y by num2, and in z by num3 | The z-axis scale is not stored in the affine transform matrix and does not affect the shape of objects. |
| rotate num or r num | rotate in the x/y plane num degrees | |
| flip num or f num | reflect in x/y plane across a line through the origin at num degrees | |
| skew num1 num2 | shear transform in x/y plane num1 degrees from the y axis and num2 degrees from the x axis |
The color of a shape is represented by two points in the HSBA color space (HSB color plus alpha, or opacity). One point is the color that the shape is actually drawn in and the other point is a target that the drawing color trends toward. The HSBA coordinates are [0,360) for hue, [0,1] for saturation, [0,1] for brightness, and [0,1] for alpha (opacity).
| Abbreviations: 'hue' can be abbreviated as 'h', 'saturation' can be abbreviated as 'sat', 'brightness' can be abbreviated as 'b', and 'alpha' can be abbreviated as 'a'. |
There are four more drawing color adjustments for changing the drawing color components with respect to the target color. This useful is you have a recursive shape rule that adjusts a color component and you don't want to overshoot a value. For example, the drawing hue is red and you want the drawing hue to trend toward yellow, but never go past yellow to green.
For example, the following code applied consistently when drawing shapes, will change the initial hue 0 (red) quickly to yellow (hue 60) but not let it go past yellow towards green:
MyShape { h 60|h 0.99 } // yellow hues
More on targeting colors can be found in the tutorial Targeting a color.
Remember that the initial hue is always 0, i.e red. Some common hues follow:
| Hue number | Primary | Secondary | Tertiary |
|---|---|---|---|
| 0 | Red | ||
| 30 | Orange ("Red-Yellow") | ||
| 60 | Yellow | ||
| 90 | Yellow-Green | ||
| 120 | Green | ||
| 150 | Aqua ("Green-Cyan") | ||
| 180 | Cyan | ||
| 210 | Turquoise ("Cyan-Blue") | ||
| 240 | Blue | ||
| 270 | Violet ("Blue-Magenta") | ||
| 300 | Magenta | ||
| 330 | Reddish Purple ("Magenta-Red") | ||
| 360 (=0) | Red |