Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Setting a min length while using sourceRectAtTime

  • Setting a min length while using sourceRectAtTime

    Posted by Kristjan Erusk on January 19, 2018 at 2:25 pm

    Hello everybody.

    Is there a way to set a minimum length for a shape layer while having it change length according to a text layer?

    E.g. Length = y but not shorter than x
    It would look something like this.

    And the other question would be if i have two shape layers that both change their length depending on text layers 1 and 2(with the sourceRectAtTime expression) then can I have shape layer 1 always be longer than shape layer 2 regardless of the length of the text?

    Kristjan Erusk replied 8 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Kevin Camp

    January 19, 2018 at 11:01 pm

    you can use a Math.max() function… it would allow you to select the greater value of either A or B…

    say you had this:

    A = 100 ;
    B = 20;
    Math.max( A, B )

    it would return 100, since 100 is larger than 20.

    so if you had this:

    A = 100 ;
    B = sourceRectAtTime().width ;
    W = Math.max( A, B )

    if B was less than 100, W would equal 100, if B was greater than 100, then W would equal B

    Just FYI, Math.min() works the same but returns the smaller value.

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

  • Kristjan Erusk

    January 21, 2018 at 1:30 am

    Thanks, this worked perfectly.

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