Copy link to clipboard
Copied
hi!
I want to do a simple loop through a text array and write it out at a given interval.
I thought this would be a simple task but I can't get the actual loop to build on itself – instead I get the end result right away, since how AE interprets code.
Anyone have an easy to use solution for looping through a text array?
Maybe this will give you some ideas:
txt = "this is a line of text";
words = txt.split(" ");
freq = 1; // words per second
n = Math.floor((time - inPoint)/freq);
n = Math.min(n,words.length-1);
str = "";
for (i = 0; i <= n; i++){
str += (i > 0 ? " " : "") + words;
}
str
Dan
Copy link to clipboard
Copied
An example of what you're trying to do would be helpful.
Dan
Copy link to clipboard
Copied
What I'm trying to do is this:
I've seperated an long text into individual words using .split(). I'm then showing each word for a number of frames running through the whole array.
I also would like to write out the entire sentance word by word in the same tempo. Hence my effort in trying to loop through the entire array – not just the current word but everything from start up to the current word.
I'm not sure how to process this since AE appear to calculate the code to it's end before running it – giving me only the last part of the array not everything from the first TO the last.
Copy link to clipboard
Copied
Maybe this will give you some ideas:
txt = "this is a line of text";
words = txt.split(" ");
freq = 1; // words per second
n = Math.floor((time - inPoint)/freq);
n = Math.min(n,words.length-1);
str = "";
for (i = 0; i <= n; i++){
str += (i > 0 ? " " : "") + words;
}
str
Dan
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more