Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Exponential Functions in AE Expressions

  • Exponential Functions in AE Expressions

    Posted by Roman Alvarado on June 30, 2008 at 1:00 pm

    Hello. I am completely new to AE and recently began working with Expressions from scratch. I want a 2D object to scale from 10% to 100% over a modifiable length of time. However, I do not want the transformation to be linear and I don’t want to create keyframes since this effect will later be triggered by another layer’s properties.

    begS=10;//initial and minimum scale
    dK=.95//decay rate, must be < 1 xScale=begS+90-(90*(dK^time));// initial time + 90- a value that decreases with time from 90, never reaching 0. yScale=xScale [xScale,yScale] I suspect it's a noob's syntax or language issue because the formula looks right in a graphing calculator. Basically, when I use this expression the animation jumps around and begins at 100% scale. Anything to the 0 power is 1, so the scale value at time=0 should be: 10+90-(90*1)=10%. At time=1, the scale should be: 10+90-(90*.95)=14.5%... and so on. Thanks you for any help. I searched the forums and found no explicit discussion about exponential notation within After Effects Expressions.

    Nick Depp replied 14 years, 5 months ago 3 Members · 3 Replies
  • 3 Replies
  • Darby Edelen

    June 30, 2008 at 5:39 pm

    [Roman Alvarado] “I searched the forums and found no explicit discussion about exponential notation within After Effects Expressions.”

    You can use any JavaScript math functions in AE expressions.

    https://www.javascripter.net/faq/mathfunc.htm

    I believe the one you’re looking for is Math.pow(a,b)

    Darby Edelen
    Lead Designer
    Left Coast Digital
    Santa Cruz, CA

  • Roman Alvarado

    June 30, 2008 at 7:26 pm

    Ha! I knew it was a simple mistake. That’s what I was looking for, thank you. I did manage to figure out a very roundabout solution to create a similar effect, but not as adjustable:

    timeToFrames(t = time + thisComp.displayStartTime, fps = 1.0 / thisComp.frameDuration, isDuration = false)
    timePos=((thisComp.layer(“Shape Layer 1”).transform.position[0])-position[0])/fps;
    hxPos=thisComp.layer(“Shape Layer 1”).transform.position[0];
    pPos=position[0];
    sx=10+90-(90*Math.exp(-timePos));
    sy=sx;
    sz=sx;
    if(hxPos>pPos){
    [sx,sy,sz];
    }else{[10,10,10]};

    Thanks for the response.

  • Nick Depp

    November 18, 2011 at 12:42 pm

    the natural logarithmic function uses exponent integer e as its base value whose constant value is 2.718.

    natural logarithmic functions are easily converted into its relative exponential functions as following:

    log e y = x

    to convert it into exponential form both RHS and LHS are put in exponent’s power as

    e log e y = ex

    we know that the exponents and logarithm are opposite to each other so

    e cancels the log on LHS:

    y = ex

    ‘e’ is also known as Euler Constant.

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