transform
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| transform [2026/10/25 02:27] – Markup fix for the DokuWiki upgrade (spaces inside bold/italic) 0.0.0.0 | transform [2026/10/25 02:53] (current) – Help pages updated for PowerScripts 3.8 (help pages session) remoteuser | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ==== What is Transform+ ==== | + | ====== Transform+ |
| - | Transform | + | Transform |
| - | ==== Why is this needed? ==== | + | [[https:// |
| - | 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. | + | ===== Where to find it ===== |
| - | ==== How does it work ==== | + | Open the PowerScripts panel (**Window > Extensions > PowerScripts**) and choose **Transform+** from the **Tools** scripts. The script has two tabs: **Transform+** and **Help** (a quick reference of the variables and functions below). |
| + | |||
| + | ===== Quick start ===== | ||
| + | |||
| + | To make every selected shape half as wide: | ||
| + | |||
| + | - Select the shapes. | ||
| + | - Open **Size**, tick **Width** and type '' | ||
| + | - Press **Transform**. | ||
| + | |||
| + | Try the ready-made examples too: they come as saved settings (see [[using_presets|Using Presets]]). | ||
| + | |||
| + | {{: | ||
| + | |||
| + | ===== How it works ===== | ||
| 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. | 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. | ||
| Line 13: | Line 27: | ||
| - | ==== Interface | + | ===== Options ===== |
| === Variables === | === Variables === | ||
| Line 24: | Line 38: | ||
| === Filter === | === Filter === | ||
| {{: | {{: | ||
| - | Set a condition to filter the selection, If the result is false then the shape it not selected. | + | Set a condition to filter the selection, If the result is false then the shape is left out. |
| === Sort=== | === Sort=== | ||
| Line 58: | Line 72: | ||
| * **Examples**: | * **Examples**: | ||
| * To scale just multiply by a number [width * 0.5 ] will scale by 50% | * To scale just multiply by a number [width * 0.5 ] will scale by 50% | ||
| - | * To ensure | + | * To make sure the width is never more than 100 use [ min(100, width) ] |
| * To round the width to be multiples of 10 use [ round(width / 10) * 10 ] or modulus math [ width - (width %10) ] | * To round the width to be multiples of 10 use [ round(width / 10) * 10 ] or modulus math [ width - (width %10) ] | ||
| Line 76: | Line 90: | ||
| * **x** Sets the x position of the shape | * **x** Sets the x position of the shape | ||
| - | * **y** Sets the x position of the shape | + | * **y** Sets the y position of the shape |
| * **Examples** | * **Examples** | ||
| * Set each shape to be 10mm further away from the left of the artboard [ artboard.x + (index * 10) ] | * Set each shape to be 10mm further away from the left of the artboard [ artboard.x + (index * 10) ] | ||
| Line 82: | Line 96: | ||
| * butt fit each shape next to the first shape in a row so they line up - set x:[ index == 0 ? first.x : previous.x + previous.width ] and set y:[ first.y ] | * butt fit each shape next to the first shape in a row so they line up - set x:[ index == 0 ? first.x : previous.x + previous.width ] and set y:[ first.y ] | ||
| * Set x to a random position on the artboard but make sure it does not go over the edge x:[ artboard.x + (artboard.width - width) * random() ] | * Set x to a random position on the artboard but make sure it does not go over the edge x:[ artboard.x + (artboard.width - width) * random() ] | ||
| - | * Complicated example to layout shapes in a grid 5 items acoss with 100mm wide and 150mm high | + | * Complicated example to layout shapes in a grid 5 items across |
| * x: [ artboard.x + (index % 5) * 100 ] ... (index % 5) returns a number 0 to 4 | * x: [ artboard.x + (index % 5) * 100 ] ... (index % 5) returns a number 0 to 4 | ||
| * y: [ artboard.y + floor(index / 5) * 150) ... floor(index / 5) returns the row number | * y: [ artboard.y + floor(index / 5) * 150) ... floor(index / 5) returns the row number | ||
| Line 88: | Line 102: | ||
| === Stroke === | === Stroke === | ||
| {{: | {{: | ||
| - | **See table below for special color variables | + | **See table below for special color variables |
| * **Width** Sets the width of the stroke IN POINTS | * **Width** Sets the width of the stroke IN POINTS | ||
| Line 95: | Line 109: | ||
| * **Examples** | * **Examples** | ||
| * See the screenshot above for an example of how to set the stroke to be the same as the fill color | * See the screenshot above for an example of how to set the stroke to be the same as the fill color | ||
| - | * Ensure | + | * Make sure all strokes are at least 0.25 points |
| * Set the stroke to be 5% of the width of the shape with a maximum of 10 points and minimum of 1 point [ max( 1, min( 10, width * 0.05 ) ) ] | * Set the stroke to be 5% of the width of the shape with a maximum of 10 points and minimum of 1 point [ max( 1, min( 10, width * 0.05 ) ) ] | ||
| === Fill === | === Fill === | ||
| {{: | {{: | ||
| - | Set or modify the fill color **See table below for special color variables | + | Set or modify the fill color **See table below for special color variables |
| * **Color** Sets the Color - Choose either RGB or CMYK colors to set. | * **Color** Sets the Color - Choose either RGB or CMYK colors to set. | ||
| Line 108: | Line 122: | ||
| * Tint a colour to 50% C:[ fill.cyan * 0.5 ] | * Tint a colour to 50% C:[ fill.cyan * 0.5 ] | ||
| * Invert an RGB color R: [ 255 - R ] - Using ' | * Invert an RGB color R: [ 255 - R ] - Using ' | ||
| - | * To eliminate | + | * To remove |
| * To gamma adjust an RGB color R:[ 255 * (R / 255) ^ gamma ] or R:[ 255 * (R / 255) ^ (1/gamma) ] | * To gamma adjust an RGB color R:[ 255 * (R / 255) ^ gamma ] or R:[ 255 * (R / 255) ^ (1/gamma) ] | ||
| Line 129: | Line 143: | ||
| * **Example** | * **Example** | ||
| * Delete all shapes smaller than 10 x 10 - set condition: [ width < 10 and height < 10 ] | * Delete all shapes smaller than 10 x 10 - set condition: [ width < 10 and height < 10 ] | ||
| - | * Delete all shapes with no fill and no stroke - set contition: [ filled == 0 and stroked == 0 ] | + | * Delete all shapes with no fill and no stroke - set condition: [ filled == 0 and stroked == 0 ] |
| === Options === | === Options === | ||
| Line 136: | Line 150: | ||
| * **Scale Stroke Patterns** Scale Strokes and Stroke Patterns when resizing | * **Scale Stroke Patterns** Scale Strokes and Stroke Patterns when resizing | ||
| * **Scale Gradients** | * **Scale Gradients** | ||
| - | * **Scale Strokes** | + | * **Scale Strokes** |
| * **Clear Selection** Clear the selection when completed, same as Select None | * **Clear Selection** Clear the selection when completed, same as Select None | ||
| * **Apply to all items inside groups** When ticked grouped items are treated as ungrouped shapes | * **Apply to all items inside groups** When ticked grouped items are treated as ungrouped shapes | ||
| * **Size Units** The units used for positioning (x / y) and size (height / width). | * **Size Units** The units used for positioning (x / y) and size (height / width). | ||
| - | ==== Complex Examples | + | ===== More examples ===== |
| See the pre-saved defaults that come with the install. | See the pre-saved defaults that come with the install. | ||
| - | ==== Variables and Functions (Technical bit) | + | ===== Variables and functions ===== |
| Below are the variable, operators and functions you can use. | Below are the variable, operators and functions you can use. | ||
| Line 152: | Line 166: | ||
| ^ Variable ^ Type ^ Description ^ | ^ Variable ^ Type ^ Description ^ | ||
| | area | number | area of the shape as calculated by illustrator, | | area | number | area of the shape as calculated by illustrator, | ||
| - | | closed | 1 = true \\ 0 = false | true of the shape is closed, false if it is open | | + | | closed | 1 = true \\ 0 = false | true if the shape is closed, false if it is open | |
| | stroked | 1 = true \\ 0 = false | true if the shape has a stroke | | | stroked | 1 = true \\ 0 = false | true if the shape has a stroke | | ||
| | strokeWidth | number | the Width of the stroke in points | | | strokeWidth | number | the Width of the stroke in points | | ||
| Line 170: | Line 184: | ||
| ^ Variable ^ Type/ | ^ Variable ^ Type/ | ||
| - | | start. | shape \\ \\ For Example\\ start.width \\ start.opactiy | + | | start. | shape \\ \\ For Example\\ start.width \\ start.opacity |
| | 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. | 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: < | ||
| - | | 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. | shape \\ \\ For Example\\ previous.area \\ previous.closed \\ previous.fill \\ ....| Refers to the previous shape, for example to butt fit the current shape to the previous shape you can set the x position \\ x: < |
| | 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 | 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: < | ||
| - | | 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 | | + | | 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 | |
| Line 180: | Line 194: | ||
| In addition to the shape variables you can also use | In addition to the shape variables you can also use | ||
| ^ Variable ^ Type ^ Description ^ | ^ Variable ^ Type ^ Description ^ | ||
| - | | index | number | The index of the shape, if 5 shapes are selected then this will range form 0 to 4 | | + | | index | number | The index of the shape, if 5 shapes are selected then this will range from 0 to 4 | |
| | count | number | | count | number | ||
| Line 203: | Line 217: | ||
| === Functions === | === Functions === | ||
| - | Size finctions | + | Size functions |
| ^ Operator ^ Returns^ Description ^ | ^ Operator ^ Returns^ Description ^ | ||
| - | | mm(n) | points | Convert n milimeters | + | | mm(n) | points | Convert n millimeters |
| | cm(n) | points | Convert n centimeters to points | | | cm(n) | points | Convert n centimeters to points | | ||
| | m(n) | points | Convert n meters to points | | | m(n) | points | Convert n meters to points | | ||
| Line 216: | Line 230: | ||
| | +x | Unary plus. This converts it's operand to a number, but has no other effect. | | | +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. | | | x! | Factorial (x * (x-1) * (x-2) * … * 2 * 1). gamma(x + 1) for non-integers. | | ||
| - | | abs x | Absolute value (magnatude) of x | | + | | abs x | Absolute value (magnitude) of x | |
| | acos x | Arc cosine of x (in radians) | | | acos x | Arc cosine of x (in radians) | | ||
| | acosh x | Hyperbolic arc cosine of x (in radians) | | | acosh x | Hyperbolic arc cosine of x (in radians) | | ||
| Line 223: | Line 237: | ||
| | atan x | Arc tangent of x (in radians) | | | atan x | Arc tangent of x (in radians) | | ||
| | atanh x | Hyperbolic 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 | | + | | ceil x | Ceiling of x: the smallest integer that’s >= x | |
| | cos x | Cosine of x (x is in radians) | | | cos x | Cosine of x (x is in radians) | | ||
| | cosh x | Hyperbolic cosine of x (x is in radians) | | | cosh x | Hyperbolic cosine of x (x is in radians) | | ||
| | exp x | e%%^%%x (exponential/ | | exp x | e%%^%%x (exponential/ | ||
| - | | floor x | Floor of x — the largest integer that’s <= x | | + | | floor x | Floor of x: the largest integer that’s <= x | |
| | length x | String length of x | | | length x | String length of x | | ||
| | ln x | Natural logarithm of x | | | ln x | Natural logarithm of x | | ||
| Line 270: | Line 284: | ||
| - | ==== Release Notes ==== | + | ===== What's new ===== |
| - | * **1.4.0** - October 2023 | + | |
| - | * Added Extendscript code | + | |
| - | + | ||
| - | * **1.3.1** - 17 December 2017 | + | |
| - | * Requires PowerScripts 3.4.2 | + | |
| - | * CC2018 Fixes | + | |
| - | * Saving presets also saves accordions status of expanded to closed. | + | |
| - | + | ||
| - | * **1.3.0** - 25 November 2017 | + | |
| - | * Added typename property | + | |
| - | * Added Filter section | + | |
| - | * Added Delete section | + | |
| + | * **1.4.5** | ||
| + | * Improved: Sort is much faster on thousands of shapes, and shapes with the same value keep their order. | ||
| + | * Fixed: index counts from 0 again with Filter, Delete or Sort. | ||
| + | * Fixed: Apply to all items inside groups changes only the items inside. | ||
| + | * Improved: general bug fixes, reliability and speed. | ||
| + | * **1.4.3**: Updated for PowerScripts 3.8.32. | ||
| + | * **1.4.2**: Updated for the new version of PowerScripts. | ||
| + | * **1.4.0**: Added Extendscript code. | ||
| + | * Older changes: [[releasenotes|PowerScripts Release Notes]] | ||
transform.txt · Last modified: by remoteuser