ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

How to import multi-line text file as Source Text keyframes

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Chris Svensson
How to import multi-line text file as Source Text keyframes
on Jun 3, 2016 at 5:08:48 am

Hi all, I apologize if this has been covered before but I can't seem to find the answer on these forums or anywhere else on the web.

I have a long text document with short lines of dialogue divided by paragraph breaks. I am hoping to find a way to import this into an After Effects text layer as Source Text without having to copy and paste each line manually into a new keyframe. Is this possible? I thought I was onto something when I learned about the Buzz Words animation preset/expression but I can't seem to convert each line of dialogue into a new Source Text keyframe.

Let me just explain what I'm hoping to do in case this is unclear. Say I have a text file with the following:
Happy birthday to you
Happy birthday to you
Happy birthday dear CC
Happy birthday to you

I'd love to find a way to import each line as its own keyframe in that same sequence. So imagine this is the Source Text parameter on the timeline:

[Keyframe 1]Happy birthday to you [Keyframe 2]Happy birthday to you [Keyframe 3]Happy birthday dear CC [Keyframe 4]Happy birthday to you

The timing of the keyframes doesn't matter at all (they could be spaced 1 frame or 1 second apart) I will drag the keyframes manually to sync them to the dialogue. I'm just trying to avoid doing what I've been doing so far: 1. go to text document 2. select line of text 3. copy line of text 4. go to After Effects 5. create Source Text keyframe 6. paste copied text 7. repeat […]

I got the Buzz Words expression working, but I couldn't figure out a way to translate the results into keyframes which I could reposition on the timeline.

Any ideas would be greatly appreciated. Thank you!


Return to posts index

Walter Soyka
Re: How to import multi-line text file as Source Text keyframes
on Jun 3, 2016 at 2:58:19 pm

Here's a modification of my scoreboard expression [link] which will allow you to enter or paste multi-line text on a text layer in Ae, showing only a single line at a time and advancing to each next line with layer markers. Alt+click the Source Text property stopwatch of your text layer and paste in this expression:

lines = value.split("\r");
m = thisLayer.marker;
i = m.nearestKey(time).index;
if (m.nearestKey(time).time > time){ i--;}
if (i < 1) { i = 1};
i--;
lines[i]


You must have at least one layer marker on the text layer, or the expression will fail.

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Chris Svensson
Re: How to import multi-line text file as Source Text keyframes
on Jun 4, 2016 at 1:10:56 am

Walter, thank you so much! Your expression is really great and I managed to use it despite my relative ineptitude when it comes to expressions. I think the only issue I might have in this particular project is, I am sure I am going to have to go in many times and make text edits. Also, the text formatting of each line will be different.

Do you know if there's any way to run your expression, and then somehow convert all the markers into Source Text hold keyframes?

Thank you again for your help!


Return to posts index


Walter Soyka
Re: How to import multi-line text file as Source Text keyframes
on Jun 8, 2016 at 11:08:56 am

Sorry, Chris, I guess I misunderstood your original response. I haven't tried it for this case, but a script like Zack Lovatt's Easy Bake [link] might help you.

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]