Skip to main content

transform

The transform macro allows you to rotate/scale/translate points and/or paths.

It is provided by the transform plugin, which is part of core-plugins (so it is available by default).

Signature

macro('transform', {
String transform,
Number x, y,
Number angle,
Point c,
Boolean clone,
Array points,
Array paths,
String or Function prefix,
})

Example

rotate scale translate

Examples of the transform macro

Configuration

PropertyDefaultTypeDescription
transformstringString indicating the action to perform. Must be one of: rotate, scale, or translate
clonetrueboolWhether to clone transformed points and/or paths
pointsarrayAn array of pointnames, the names of Points in the points array to transform
pathsarrayAn array of pathnames, the names of Paths in the paths array to transform
prefixtransformedstringOne of:
  • A prefix to apply to the names of the clones points and or paths.
  • A method that receives the name of the path or point as a first argument and one of path or point as the second argument and should return the name for the cloned path and or point
cnew Point(0,0)PointThe point used to rotate around (or scale from)
angle0floatThe angle of rotation, used with the rotate option
x0floatHow far to move in the X direction in the translate option or
How much to scale in the X direction in the scale option
y0floatHow far to move in the Y direction in the translate option or
How much to scale in the Y direction in the scale option

Notes

When using the scale option, a center point is recommended. The macro does not automatically calculate the center point for the arrays of points and paths. If omitted, a default of new Point(0,0) will be used.