Activity › Forums › Adobe After Effects Expressions › Expression for list of words
-
Expression for list of words
Posted by Ryan Steer on February 23, 2009 at 11:20 pmHello,
First up this is my first post so thanks for being patient if it’s in the wrong format etc.
Secondly, wow, great site you’ve got here.
The reason for this post is that I’m trying to animate some words. Very basically. All I want is an expression that will change the words in a text layer based on those from a list. That’s all, no cameras, explosions or dancing girls. If anyone can help I would be extremly grateful.
Thanks
Husam Sibai replied 10 years, 9 months ago 7 Members · 10 Replies -
10 Replies
-
Paul Hennell
February 24, 2009 at 2:26 amWhen you say ‘change the words based on those from a list’ I’m not entirely sure what you mean. I think point number seven from this tutorial might help, but you might need to explain further.
(Also it’s always a mistake to rule out exploding dancing girls – they add to every effect)
—
Only in after effects do children get to pick and whip their parents.
https://hennell-online.co.uk -
Ryan Steer
February 24, 2009 at 1:36 pmHi, thanks for the reply.
What I am trying to achieve is a comp in which a new word appears, replacing the previous word, every second. As I want to use around 200 words its a bit time consuming to do this with key frames so I looking for an expression that I can paste a list of words into that will do it for me. It doesn’t need to be random but could be if easier.
I tried the one from the tutorial you suggested but the it just stuck one of the words up and left it there. Am I missing something? I’m guessing that I need to modify the expression in some way.
I hope that sort of makes sense and thanks : )
-
Brendan Mccullough
February 24, 2009 at 3:29 pmTry modifying the expression used in the AE preset ‘buzz words’ (or ‘pop buzz words’, I don’t remember what it is). It parses a list of words separated by pipes (|), so you should be able to add words and specify how long they stay on screen.
-
Paul Hennell
February 24, 2009 at 3:55 pmYeah the expression linked was just to show how to add a list of words to the source text, (which you want) but it’s current purpose is to chose a random word from the list each time you duplicate (which is the bit we’ll now change).
The key part of the tutorial expression is the last line which says “
MyText[Myindex]” which basically means ‘choose the item from the “MyText” list which corresponds to whatever number MyIndex is“. If you replaced the end with “MyText[1]” the text would always read the 2nd item (lists start counting at 0) so we just need to change that value once a second.Happily that’s very easy – AE has a time keyword which gives the current time line value which will will cycle us through the list (Provided we use ‘Floor’ to keep it a whole number”). So our end expression looks like:
myText = ["After Effects",
"Encore DVD",
"Photoshop",
"Premiere Pro",
"Final Cut Pro",
"Motion",
"Broadcast",
"Commotion",
"Cinema 4D",
"Particle Illusion"]; // obviously add your own list heret = Math.floor(time) //this makes time a whole number.
myText[t] //This will cycle through your text once a second.That should work fine, and you can even make it faster easily by multiplying the time: “
t = math.floor(time * 2)” will make it cycle through twice as fast.—
Only in after effects do children get to pick and whip their parents.
https://hennell-online.co.uk -
Ryan Steer
February 28, 2009 at 5:49 pmHi,
Thanks so much for the help, worked perfectly!
Cheers,
Ryan
-
Emily Scollon
April 17, 2013 at 8:54 pmSo this is years later, but I figure i’ll ask, I used this code and am still have the issue where it gets stuck. When i change to your updated code it says warning “no property or method named ’10’ and that i have an error in the 14th line –
myText[t] //This will cycle through your text once a second.when i move that text up a layer it starts counting from 0 up when animated? ha.
Thanks!
-
Brendan Mccullough
April 19, 2013 at 1:19 amWow! This takes me back. I had an email setup to notify me of responses to this thread. Crazy.
I hardly use AE much anymore, as I’m primarily an editor, but if you copy and paste your code, I’ll take a look.
-
Navarro Parker
May 20, 2015 at 9:03 pmI’m getting an error with this and Buzzwords in AE CC2014.2
With your script, I’m getting this error when RAM previewing. (It accepts it at first, but errors out once I start moving the playhead)
Property or method ’10’ in Class ‘Array’ is missing or does not exist.
Source Text (line 13) of Layer 1…With the buzzwords preset, I’m getting the error “Property of method ‘-1’ etc etc.
Any ideas?
-
Husam Sibai
August 9, 2015 at 9:12 amthis happens because the provided code only works as long as time does not exceed the number of words in your matrix.
once that happens it breaks.
What i suggest is using the operand % (reminder) to cycle through the words like this:
(the number 10 would become 12 if you provide 12 words etc..)myText = ["After Effects",
"Encore DVD",
"Photoshop",
"Premiere Pro",
"Final Cut Pro",
"Motion",
"Broadcast",
"Commotion",
"Cinema 4D",
"Particle Illusion"];
t = Math.floor(time)%10;
myText[t]
Reply to this Discussion! Login or Sign Up