Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions A way to return the MAX or MIN for a fluctuating value?

  • A way to return the MAX or MIN for a fluctuating value?

    Posted by Lu Nelson on July 9, 2009 at 6:39 pm

    Quick question —

    is there a mechanism in expressions where we can point to a value (let’s say a slider in another effect which is being driven by an expression in itself) and return it’s maximum (and minimum) values — as reached anywhere within the duration of the comp — as static numbers?

    THX
    LMN

    Lu Nelson
    Berlin, Germany

    [MacProQ2.66, 8GB, Sys10.5.6, FCP 6.0.5, AE 9.0.2]

    Lu Nelson replied 16 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    July 9, 2009 at 7:47 pm

    You have to loop through the comp, checking the value at each frame. Something like this should work:

    minVal = 9999999;
    maxVal = -9999999;

    parm = // your slider here

    t = 0;
    while (t < thisComp.duration){ if (parm.valueAtTime(t) >= maxVal) maxVal = parm.valueAtTime(t);
    if (parm.valueAtTime(t) <= minVal) minVal = parm.valueAtTime(t); t += thisComp.frameDuration; } At the end of the loop minVal and maxVal have the values you're looking for. Dan

  • Lu Nelson

    July 9, 2009 at 8:42 pm

    Awesome, Dan

    Thanks — that’ll save me a lot of handwork

    Lu Nelson
    Berlin, Germany

    [MacProQ2.66, 8GB, Sys10.5.6, FCP 6.0.5, AE 9.0.2]

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