Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change text.layer duration base on word

  • Change text.layer duration base on word

    Posted by Felix Labelle on November 9, 2016 at 5:52 pm

    Hi,

    I’m looking for a expression or probably in this case a script that can automatically adapt the duration of a text layer base on the number of word.

    I saw an old post close to that idea but change the duration of the comp layer and not the text layer.

    var myComp = app.project.activeItem;
    var myLayer;
    var numWords = 0;

    for (var i = 1; i <= myComp.numLayers; i++){
    myLayer = myComp.layer(i);
    if (myLayer instanceof TextLayer){
    numWords += myLayer.property(“Text”).property(“Source Text”).value.toString().split(” “).length;
    }
    }
    myComp.duration = 2 + Math.floor(numWords/3);

    This script was write by Dan Ebberts (creative cow forum hero) in this post : https://forums.creativecow.net/thread/227/28672

    So let say that I have a comp with multiple text layer, with different number of word, I would like to be able to select the text layer and apply the script or the expression to change the duration of the layer base on 3 word a second and also put 2 sec because I have a text animation and it stop 2 sec before the end of the text layer duration.

    Looking for this kind of formula Text.layer Total Duration = (3 words/sec.)+2 sec.

    Hope someone can help me.

    Thank you !

    Felix Labelle replied 9 years, 9 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy