Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Is it possible to know the number of lines of a box text?

  • Dan Ebberts

    July 4, 2015 at 7:38 pm

    I don’t think there’s a direct way, but you might be able to deduce it from the value of sourceRectAtTime(time,false).height, assuming you know the leading value. This seems to work pretty well:


    leading = 30;
    L = thisComp.layer("text");

    h = L.sourceRectAtTime(time,false).height;
    if (h == 0){
    n = 0;
    }else if (h < leading){
    n = 1;
    }else{
    n = Math.ceil(h/leading);
    }
    n

    Dan

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