Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Math.ceil finding the highest value of a key framed property over entire composition?

  • Math.ceil finding the highest value of a key framed property over entire composition?

    Posted by James Ronan on February 3, 2016 at 9:34 am

    Hello all.

    Is it possible to have a Math.ceil expression or something else that finds the highest value of keyframes within a layers property?

    e.g.

    SliderA animates from 0 – 100 – 50 over 3 seconds.

    Slider B has a Math.ceil expression looking at SliderA. and knows that 100 is the highest value it will be over 3 seconds so has a constant value of 100.

    Not sure if that is even possible but if it is it would be super handy!

    James

    James Ronan replied 10 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 3, 2016 at 2:31 pm

    You’d have to loop through the keyframes. Something like this should work:


    s = effect("SliderA")("Slider");
    if (s.numKeys > 0){
    maxVal = -9999999;
    for (i = 1; i <= s.numKeys; i++){
    maxVal = Math.max(maxVal,s.key(i).value);
    }
    maxVal
    }else
    s.value

    Dan

  • James Ronan

    February 3, 2016 at 4:45 pm

    Wow! Yes, That is perfect!

    This works brilliantly! Thank you so much!

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