Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Exponential Curve Expression

  • Exponential Curve Expression

    Posted by Jon Smith on March 28, 2008 at 4:24 pm

    Hello all,

    I need to scale and move an objects as if it was in 3D space. Using Exponential Scale works well for the scale but when I also move the postion of the object it makes the obect appear to curve in space instead of just receding back.

    So I believe I need the position to have the same exponential curve. I found an expression here from Dan Ebberts to add an exponential curve between two key frames.

    if (numKeys > 1){
    v1 = key(1).value;
    v2 = key(2).value;
    t1 = key(1).time;
    t2 = key(2).time;
    if (time > t1 && time < t2){ t = time - t1; T = t2 - t1; k = Math.log(v2/v1)/T; v1*Math.exp(k*t) }else{ value } }else{ value } Problem is I can't seem to get it to work. I'm just copy and pasting that into the property values. Is that right? I'm fairly new to expressions so any help is appreciated. -jon

    Selim Mete replied 9 years, 9 months ago 4 Members · 7 Replies
  • 7 Replies
  • Jon Smith

    March 28, 2008 at 9:19 pm

    Just wanted to add that the error I receive is:

    Bad method arguments: second argument to div() must be a scalar

    And also Is there a way to add easing to these moves?

    Thanks again

  • Filip Vandueren

    March 30, 2008 at 7:13 pm

    I usually do exponential scaling with a slider:

    add a expression slider-control to your layer and rename the slider to “Z”

    Give the layer’s scale this expression:


    exp = effect("Z")("Slider");
    Math.pow(1.01,exp) * value;

    Positive values for the slider => bigger, negative => smaller.
    The nice thing about this is that you can ease the keyframes on that slider. Or even add an expression to it etc. (I usually add a smooth).
    you can also still use the scale of the value if you need to flip or disproportiantely scale the layer because it get’s mulitplied in.

    If you want the 2D-position to also fake perspective (smaller= nearer to the vanishing point), add this expression to position:


    exp = effect("Z")("Slider");

    compCenter=[thisComp.width,thisComp.height]/2;

    compCenter + Math.pow(1.01,exp) * (value-compCenter);

    Note: if your layers are parented, stuff get’s more complicated, so this will probably not look okay then.

  • Selim Mete

    July 23, 2016 at 8:45 pm

    Hi Filip,

    In my AE project, I have a counter that needs to speed up exponentially as it counts down.
    The numbers are going down from 30 so I can do this manually by creating keyframes but I’d rather learn from this experience and do it using expressions.

    Do you think your solution can be applied to my case?
    I’m a newbie in AE programming so hopefully my question isn’t too simple or obvious.

    Thanks,

    Selim

  • Kalleheikki Kannisto

    July 24, 2016 at 8:09 am

    Since you have exact beginning and end values, it is easier to do this with a slider and use either keyframe assistant or the graph editor to make it exponential.

  • Selim Mete

    July 24, 2016 at 10:34 am

    Hi Kalle,
    Thanks for your quick response.
    I know pretty much nothing about AE expressions thus haven’t used a slider to modify text values. The problem is I don’t even know what to search for to find a tutorial that can help me with this.
    Do you have any recommendations?
    I’d also be happy to hire your services (or buy you a beer if it’s something super quick) to teach me how to do this 🙂
    In the meantime I’ll keep watching some tutorials and see if I can figure it out.

  • Kalleheikki Kannisto

    July 25, 2016 at 8:34 am

    It’s pretty straightforward:

    – Add a slider to a layer, animate it from 30 to 0 with two keyframes

    – Pickwhip the slider to the source text expression of your text layer. You’ll probably want to round the value to integers, for which you can use the round expression Math.round(pick-whipped-value-here)

    then either

    a) Select the two keyframes for the slider value, right click and select keyframe assistant > exponential

    or, for more detailed control

    b) click on the “show in graph editor” button for the slider value and switch to the graph editor and adjust the curve to be exponential

  • Selim Mete

    July 26, 2016 at 9:32 am

    Thanks so much! Worked like a charm.

    The only thing was that Math.round rounds it down at .5 which I worked around by entering beginning value as 30.5 instead of 30 (I’m sure there is a math function to do this as well), then with the right line graph all the other seconds lined up perfectly until the point where I intentionally was able to do the “speed ramp” and speed up the countdown exponentially, this time using a curve.

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