ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Setting the In and Out points of a text layer to align with markers via a script

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Adam Walker
Setting the In and Out points of a text layer to align with markers via a script
on Oct 20, 2019 at 10:59:54 pm

Hey all,

I'm looking into automating subtitle placement using text layers and markers.

My process is to RAM preview the video, and apply markers to a null layer as i play through the video at each point where a subtitle should be displayed.

At the moment I have been manually placing the text layer's in-point on the designated marker and then dragging the out-point of said text layer to the following marker, then placing the next text layer's in point to this marker and dragging the outpoint to the next layer and repeating for each text layer and marker going along.

This process is not too time consuming at the moment but when the text layers/subs start stacking up it becomes a little tedious and if this could be automated then it would be a dream!

I have uploaded a screen shot to better represent what I mean.
https://f1.creativecow.net/file.php?id=13832&folder=text-layer-alignment-to...

My Javascript xp is basically non existent (but i'm working on it) so I am really struggling to put something together from things I have seen in the forum.

I have seen a script to find the "timecode" of a marker, but I'm not sure how to make it work for what I want.

Hope this is doable, thanks in advanced!

Adam


Return to posts index

Dan Ebberts
Re: Setting the In and Out points of a text layer to align with markers via a script
on Oct 20, 2019 at 11:31:45 pm

This is a very basic example, tailored to your screen shot. It needs additional error checking etc. (e.g. to make sure a comp is selected, there are enough markers, etc.) but it should give you the idea:


var myComp = app.project.activeItem;
var markerLayer = myComp.layer(1);
var t;
for (var i = 2; i <= myComp.numLayers; i++){
t = markerLayer.property("Marker").keyTime(i-1);
myComp.layer(i).inPoint = t;
if (i != 2){
myComp.layer(i-1).outPoint = t;
}
}


Dan



Return to posts index

Adam Walker
Re: Setting the In and Out points of a text layer to align with markers via a script
on Oct 21, 2019 at 9:11:44 pm

As always Dan, this is brilliant and works perfectly for what I need.

Thank you once again!

Adam


Return to posts index

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