Transform + allows you to apply mathematical functions to the size, position, color etc of a shape.
Illustrator has a Transform Each tool, however while you can scale and move shapes you are limited in setting their size and other settings. With basic settings Transfrom+ allows you to do everything the Transform Each tool does, however when you start using mathematical functions you have a very powerful tool to manipulating your artwork.
For every shape selected the script gets a list of properties for the shape, You can then use these as variables to alter the shapes size, position, stroke and fill. The key feature is that you can use any variable in any field to calculate values - this can create some very powerful transformations.
Here you can define variables to be used in other sections, Use to pre-calculate or as a basic options menu allowing the user to easily change settings.
All user selected items are in an array. Use this to pre-sort the items by criteria, such as color, width, area.
Make copies of the selection rather than loop through the selection. The selected items will be treated as a group.
See table below for special color variables aviavable in this section
Set or modify the fill color See table below for special color variables aviavable in this section
This will run Javascript code on each shape being transformed, giving you extra control on modifying the shape.
These are the variables passed to the code
Set a condition which will delete the shape if it returns true
See the pre-saved defaults that come with the install.
Below are the variable, operators and functions you can use.
Variable | Type | Description |
---|---|---|
area | number | area of the shape as calculated by illustrator, Maybe a negative number depending on path direction. |
closed | 1 = true 0 = false | true of the shape is closed, false if it is open |
stroked | 1 = true 0 = false | true if the shape has a stroke |
strokeWidth | number | the Width of the stroke in points |
stroke | color (see below) | the stroke color |
filled | 1 = true 0 = false | true if the shape is filled |
fill | color (see below) | the fill color |
opacity | number | the opacity 0 - 100 |
x | number | the shapes x coordinate in points |
y | number | the shapes y coordinate in points |
height | number | the shapes height in points |
width | number | the shapes width in points |
typename | string | A shapes typename such as PathItem, CompoundPathItem, GroupItem, MeshItem, RasterItem, SymbolItem, PlacedItem, TextFrame, TextPath Refer to the Javascript scripting reference for a full list of typenames |
These objects give you access to the variables of other shapes
Variable | Type/Properties | Description |
---|---|---|
start. | shape For Example start.width start.opactiy start.x …. | Refers to the starting variables of the shape, for example if you set the value of a shape it changes, you can refer to start.width to get the value of the width before any changes were made |
first. | shape For Example first.height first.x first.stroked …. | Refers to the FIRST shape in the selection, this is also the LAST shape selected by the user, you can use this to align all shapes to the first shape. \\For example you can set the x position of all elements to be the same as the first x: first.x |
previous. | shape For Example previous.area previous.closed previous.fill …. | Refers to the previous shape, for example to but fit the current shape to the previous shape you can set the x position x: previous.x + previous.width |
artboard | artboard.x artboard.y artboard.height artboard.width | The artboard size, properties are x, y, height, width for example to set the width of a shape to half the artboard width use width: artboard.width/ 2 |
selection | selection.x selection.y selection.height selection.width selection.count} | The selection size, properties are x, y, height, width plus also count which is the number of shapes in the selection |
In addition to the shape variables you can also use
Variable | Type | Description |
---|---|---|
index | number | The index of the shape, if 5 shapes are selected then this will range form 0 to 4 |
count | number | When using the copies features, count is the copy number, First copy count is 0 |
Color values can be referenced using dot notation for example fill.cyan
Variable | Shorthand* | Type | Description |
---|---|---|---|
mode | string | either 'RGB' or 'CMYK' | |
cyan | C | number | 0 - 100 |
magenta | M | number | 0 - 100 |
yellow | Y | number | 0 - 100 |
black | K | number | 0 - 100 |
red | R | number | 0 - 255 |
green | G | number | 0 - 255 |
blue | B | number | 0 - 255 |
These only work in the fill and stroke color settings, these directly relate to the fill or stroke colour , you can just use the capital letter of the color you want to use , they are C, M, Y, K, R, G, B
For example if you wanted to divide the cyan value by two instead of writing
fill.cyan / 2
you can just write
C / 2
Size finctions
Operator | Returns | Description |
---|---|---|
mm(n) | points | Convert n milimeters to points |
cm(n) | points | Convert n centimeters to points |
m(n) | points | Convert n meters to points |
inch(n) | points | Convert n inches to points |
foot(n) | points | Convert n feet to points |
Operator | Description |
---|---|
-x | Negation |
+x | Unary plus. This converts it's operand to a number, but has no other effect. |
x! | Factorial (x * (x-1) * (x-2) * … * 2 * 1). gamma(x + 1) for non-integers. |
abs x | Absolute value (magnatude) of x |
acos x | Arc cosine of x (in radians) |
acosh x | Hyperbolic arc cosine of x (in radians) |
asin x | Arc sine of x (in radians) |
asinh x | Hyperbolic arc sine of x (in radians) |
atan x | Arc tangent of x (in radians) |
atanh x | Hyperbolic arc tangent of x (in radians) |
ceil x | Ceiling of x — the smallest integer that’s >= x |
cos x | Cosine of x (x is in radians) |
cosh x | Hyperbolic cosine of x (x is in radians) |
exp x | e^x (exponential/antilogarithm function with base e) |
floor x | Floor of x — the largest integer that’s <= x |
length x | String length of x |
ln x | Natural logarithm of x |
log x | Natural logarithm of x (synonym for ln, not base-10) |
log10 x | Base-10 logarithm of x |
not x | Logical NOT operator |
round x | X, rounded to the nearest integer, using “gradeschool rounding” |
sin x | Sine of x (x is in radians) |
sinh x | Hyperbolic sine of x (x is in radians) |
sqrt x | Square root of x. Result is NaN (Not a Number) if x is negative. |
tan x | Tangent of x (x is in radians) |
tanh x | Hyperbolic tangent of x (x is in radians) |
trunc x | Integral part of a X, looks like floor(x) unless for negative number |
Function | Description |
---|---|
random(n) | Get a random number in the range [0, n). If n is zero, or not provided, it defaults to 1. |
fac(n) | n! (factorial of n: “n * (n-1) * (n-2) * … * 2 * 1”) Deprecated. Use the ! operator instead. |
min(a,b,…) | Get the smallest (minimum) number in the list |
max(a,b,…) | Get the largest (maximum) number in the list |
hypot(a,b) | Hypotenuse, i.e. the square root of the sum of squares of its arguments. |
pyt(a, b) | Alias for hypot |
pow(x, y) | Equivalent to x^y. For consistency with JavaScript's Math object. |
atan2(y, x) | Arc tangent of x/y. i.e. the angle between (0, 0) and (x, y) in radians. |
if(c, a, b) | Function form of c ? a : b |
Operator | Associativity | Description |
---|---|---|
(…) | None | Grouping |
f(), x.y | Left | Function call, property access |
! | Left | Factorial |
^ | Right | Exponentiation |
+, -, not, sqrt, etc. | Right | Unary prefix operators (see below for the full list) |
*, /, % | Left | Multiplication, division, remainder |
+, -, || | Left | Addition, subtraction, concatenation |
==, !=, >=, ⇐, >, < | Left | Equals, not equals, etc. |
and | Left | Logical AND |
or | Left | Logical OR |
x ? y : z | Right | Ternary conditional (if x then y else z) |