D
D
DarkWood2018-01-03 14:06:15
JavaScript
DarkWood, 2018-01-03 14:06:15

[After Effects] Is it possible to display all elements of a list using expression?

Hello.
I work in After Effects CC 2018. There is a list of data (in fact, there are several lists, but at least one should be dealt with first) loaded from a JSON file. For example, let it be like this: For convenience, let's write this list directly into the expression for the Source Text of the text layer. You can display any element of the list by index. For example: Question: is it possible to iterate over and, accordingly, display all the elements of the list using expression? Or is a different approach needed to solve this problem? I found only creating a heap of layers in which the element index changes, but this method is far from rational. Does one exist? note. I tried a for loop - in such a case only the last element of the list is displayed.
lst = ['text_1', 'text_2', 'text_3']
lst[0]

for (var i = 0; i < lst.length; i++) {
lst[i];
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kovalsky, 2018-01-03
@DarkWood

Maybe something like this:

lst = ['text_1', 'text_2', 'text_3'];
interval = 2;
try {
  item = lst[ Math.floor(time/interval) ];
} catch (e) {
  item = value;
}
item

Stolen from help.adobe.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question