You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 07a9f8e
Browse filesBrowse the repository at this point in the historyBrowse files
- Added: [GuideOrientationType](../other/guideoptions.md#guideorientationtype) and [GuidePositionType](../other/guideoptions.md#guidepositiontype) enumerated values
22
+
- Added: [Item.getGuideAsObject()](../item/item.md#itemgetguideasobject) and [Layer.getGuideAsObject()](../layer/layer.md#layergetguideasobject)
23
+
- Added: `GuideOptions` overloads of [Item.addGuide()](../item/item.md#itemaddguide) / [Item.setGuide()](../item/item.md#itemsetguide) and [Layer.addGuide()](../layer/layer.md#layeraddguide) / [Layer.setGuide()](../layer/layer.md#layersetguide)
24
+
25
+
!!! warning "Differences between versions"
26
+
**Breaking change:** The integer values behind `orientationType` and `positionType` on [Item.guides](../item/item.md#itemguides) / [Layer.guides](../layer/layer.md#layerguides) differ between versions of After Effects. In the beta, always compare against the enumerated constants rather than raw integer literals.
|`orientationType`|`GuideOrientationType`|`GuideOrientationType.HORIZONTAL` or `GuideOrientationType.VERTICAL`. |
96
+
|`positionType`|`GuidePositionType`|`GuidePositionType.PIXEL` or `GuidePositionType.PERCENTAGE`. |
97
+
|`position`| Floating-point value | The guide's position, in pixels or percent depending on `positionType`. |
98
+
|`color`| Array of 3 floats |`[R, G, B]`, each `0.0`-`1.0`. |
99
+
|`pinned`| Boolean |`true` if pinned to the opposite (bottom/right) edge. |
100
+
101
+
!!! warning "Differences between versions"
102
+
**Breaking change:** The integer values behind `orientationType` and `positionType` differ between versions of After Effects. Always compare against the enumerated constants (for example [GuideOrientationType.HORIZONTAL](../other/guideoptions.md#guideorientationtype)) rather than raw integer literals — a test such as `guide.orientationType === 0` is not portable and may stop matching in a future version.
82
103
83
104
#### Type
84
105
85
-
Array; read-only.
106
+
Array of objects; read-only.
86
107
87
108
---
88
109
@@ -221,30 +242,78 @@ if (/Composition|Komposition|Composición|Composizione|コンポジション|컴
This functionality was added in After Effects 16.1 (CC 2019)
248
+
The `(orientationType, position)` form was added in After Effects 16.1 (CC 2019). The `GuideOptions` form was added in After Effects (Beta) 26.5 and is subject to change while it remains in Beta.
226
249
227
250
#### Description
228
251
229
-
Creates a new guide and adds it to the `guides` object of the Item.
252
+
Adds a guide to the item's view and returns its index. There are two forms:
253
+
254
+
-**`addGuide(orientationType, position)`** - adds a pixel guide using an orientation and a pixel position.
255
+
-**`addGuide(guideOptions)`** - adds a guide described by a [GuideOptions](../other/guideoptions.md) object, allowing percentage positioning, per-guide color, and pinning. *(After Effects (Beta) 26.5 and later; calling this form in an earlier version raises an error.)*
|`orientationType`| Integer |`0` for a horizontal guide, `1` for a vertical guide. Any other value defaults to horizontal. In After Effects (Beta) 26.5 and later you may also pass `GuideOrientationType.HORIZONTAL` / `GuideOrientationType.VERTICAL`. |
262
+
|`position`| Floating-point value | The X or Y coordinate position of the guide in pixels. Clamped to ±100,000; non-finite values are rejected. |
263
+
|`guideOptions`| GuideOptions object | A [GuideOptions](../other/guideoptions.md) describing the new guide. |
237
264
238
265
#### Returns
239
266
240
267
Integer; the index of the newly-created guide.
241
268
242
269
#### Example
243
270
244
-
Adds a vertical guide at 500 pixels on the X axis to the `activeItem` of a project.
271
+
```javascript
272
+
var item =app.project.item(1);
273
+
274
+
// (orientationType, position) form: a vertical guide at 500 px on the X axis.
275
+
item.addGuide(1, 500);
276
+
277
+
// GuideOptions form: a vertical guide at 50%, red, pinned to the right edge.
This functionality was added in After Effects (Beta) 26.5 and is subject to change while it remains in Beta. Calling it in an earlier version raises the error "getGuideAsObject() is not available in this version of After Effects."
295
+
296
+
#### Description
297
+
298
+
Returns the guide at the specified index as a [GuideOptions](../other/guideoptions.md) object, which you can modify and pass back to [setGuide()](#itemsetguide). This is a convenient way to read a guide's full state (orientation, position, position type, color, pinning).
This functionality was added in After Effects 16.1 (CC 2019)
380
+
The `(position, guideIndex)` form was added in After Effects 16.1 (CC 2019). The `(guideIndex, guideOptions)` form was added in After Effects (Beta) 26.5 and is subject to change while it remains in Beta.
310
381
311
382
#### Description
312
383
313
-
Modifies the `position` of an existing guide. Choose the guide based on its `guideIndex` inside the `Item.guides` array.
384
+
Updates an existing guide. There are two forms, distinguished by the type of the second argument:
385
+
386
+
-**`setGuide(position, guideIndex)`** - moves the guide at `guideIndex` to a new pixel `position`. *Note the order: position first, index second.* A guide's `orientationType` may not be changed after it is created.
387
+
-**`setGuide(guideIndex, guideOptions)`** - applies the properties set on a [GuideOptions](../other/guideoptions.md) object to the guide at `guideIndex`. Only the properties you set are changed (partial update). *(After Effects (Beta) 26.5 and later.)*
314
388
315
-
A guide's `orientationType` may not be changed after it is created.
389
+
!!! warning
390
+
The two forms take their arguments in the **opposite order**: the `(position, guideIndex)` form takes the position first, while the `(guideIndex, guideOptions)` form takes the index first. After Effects decides which form you mean from the type of the second argument (a number selects the `(position, guideIndex)` form; a `GuideOptions` object selects the `(guideIndex, guideOptions)` form).
0 commit comments