Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › How to get the layer with the biggest width in an a group of layers

  • How to get the layer with the biggest width in an a group of layers

    Posted by Ayoub Gharafi on June 11, 2020 at 12:25 am

    Hey guys basically I have 6 text layers ,

    Line01
    Line02
    Line03
    Line04
    Line05
    Line06

    and I want to get the value of the one with the biggest:

    sourceRectaAtTime().width

    Ayoub Gharafi replied 6 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    June 11, 2020 at 12:36 am

    There are a lot of ways to do it–this is one:


    names = ["Line01","Line02","Line03","Line04","Line05","Line06"];
    w = 0;
    for (i = 0; i < names.length; i++){
    w = Math.max(w,thisComp.layer(names[i]).sourceRectAtTime(time,false).width);
    }
    w

    Dan

  • Ayoub Gharafi

    June 11, 2020 at 12:16 pm

    Thanks man , That will do it ,Do you have an online course or something I am ready to pay for it , thanks again

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