Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/text/sourcetext.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ These functions are accessible on the [Text.sourceText](text.md#textsourcetext)

---

## `repeat()` shorthand

When the JavaScript expression engine is active, After Effects interprets a Source Text value as a JavaScript String. In a Source Text expression, `repeat()` can be called without an explicit receiver to repeat the current text value.

For example, if the Source Text value is `"AE"`, each of these expressions returns `"AEAEAE"`:

```js
repeat(3);
value.repeat(3);
text.sourceText.repeat(3);
```

!!! note
`repeat()` is the standard JavaScript [`String.prototype.repeat()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat) method, not a global After Effects method. The receiver-less form is specific to a Source Text expression and is undefined on numeric properties. To repeat a different string, call the method on that string explicitly, such as `"AE".repeat(3)`.

!!! warning
Adobe documents Source Text's JavaScript String behavior, but does not explicitly document receiver-less dispatch for standard JavaScript methods. This shorthand has been verified in After Effects 26.3 and 27.0 Beta; use the explicit `value.repeat(3)` form when clarity or portability is preferred.

---

## Attributes

### SourceText.isHorizontalText
Expand Down