Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Custom speeds when easing via expression ease(t,a,b,x,y)

  • Custom speeds when easing via expression ease(t,a,b,x,y)

    Posted by Tilman Commes on June 13, 2017 at 10:47 am

    Greetings all!

    I frequently create AE projects as presets for other people, where lots of things happen without the use of any keyframes.
    For animations I like to use the linear() and ease() expressions.

    BUT – I’m not very fond of the default easing curve….
    NOW – Is there a way of changing the default somehow. A workaround I have been using goes as follows: Somewhere I have a secret slider that animates (0-1) in my desired easing curve, which I then link to with a .valueAtTime
    It works, but I have been wondering if there was a cleaner way, preferrably all in one expression.

    Thanks a lot in advance!

    Dagur Maunason replied 2 years, 8 months ago 11 Members · 14 Replies
  • 14 Replies
  • Dan Ebberts

    June 13, 2017 at 4:45 pm

    You’d have to be able to convert your ease to a formula of some kind. Maybe one of the Penner eases comes close to what you need.


  • Tilman Commes

    June 14, 2017 at 9:33 am

    Thanks for the reply!
    I will look into that!

  • Matt Volp

    September 3, 2018 at 2:33 pm

    Hi Tim,

    I’d love to know what the solution to this was.

    Also, could you explain your workaround in a little more detail; it sounds very interesting!


  • Tilman Commes

    September 6, 2018 at 10:53 am

    I’m sorry Dan, could I ask for your help once more?
    I’m not quite sure how such a formula would look like.

    Could this formula be built in such a way that you insert the values that you would usually adjust in the Keyframe-Velocity-Menu?

  • James Ronan

    September 6, 2018 at 2:45 pm

    This was my approach when doing something similar… Maybe it will help you get started. It doesn’t have custom controls for velocity though.

    Add as an expression on the position property of a layer. It will move the layer 500px along the x axis between 1 – 2 seconds.

    function easeInOutCubic(t) { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1 };

    startVal = 0;
    endVal = 500;
    startDur = 1;
    endDur = 2;

    t = linear(time,startDur,endDur,0,1);
    e = easeInOutCubic(t);
    x = linear(e,0,1,startVal,endVal);

    [x, value[1]];

    I took the easeInOutCubic function from this website which has a variety of easing functions:

    Hope that helps

  • Jacob Mellin

    September 7, 2018 at 10:22 pm


    I think I have come up with a solution that allows you to use a custom easing function for easing between any two keyframes for a property. I am new to expressions, so there may be some issues, but it worked for me. I tested it on scale and position properties.

    EDIT: Sorry, I totally disregarded the fact that the question was about not using keyframes… Maybe someone will find this helpful anyway…

    You should be able to simply create two keyframes, as you normally would. After the function definition, call easeSingleProperty with an easing function and the two keyframes you want to tween the values for as arguments. The expression will use the property values and the time of the keyframes.

    Use any easing function that takes a value between 0 and 1 and returns an (eased) value between 0 and 1. This gist (and discussion thread) contains some functions that you could use:

    You could use for reference.

    Maybe it helps someone. 🙂

    function easeInElastic(t) { return (.04 - .04 / t) * Math.sin(25 * t) + 1 }

    function easeSingleProperty(easingFunction, startKey, endKey) {
    var startTime = startKey.time
    var endTime = endKey.time
    if(time > startTime && time < endTime) { var progress = 0; progress = (time-startTime)/(endTime-startTime); var easedProgress = easingFunction(progress); return startKey + (endKey-startKey)*easedProgress; } return value } easeSingleProperty(easeInElastic, key(1), key(2))

  • Matthias Stoll

    January 19, 2020 at 9:35 pm

    Hi Tilman, hi everybody

    Thanks for the thread and all the ideas! I combined some of the ideas to do it, based on the Penner eases. In this expression you can define start and end values in two dimensions. On top 3 Penner functions are defined, at the bottom you have to pick between EaseIn, EaseOut, EaseInOut.

    I hope someone out there still needs this…

    EaseIn = function(power){return function(t){return Math.pow(t, power)}};
    EaseOut = function(power){return function(t){return 1 - Math.abs(Math.pow(t-1, power))}};
    EaseInOut = function(power){return function(t){return t&lt;.5 ? EaseIn(power)(t*2)/2 : EaseOut(power)(t*2 - 1)/2+0.5}}

    dur=1; power=5; //1=linear, 2=Quad, 3=Cubic, 4=Quart, 5=Quint
    startX=value[0]; startY=value[1];
    endX= ; endY= ;


  • Marc Pelletier

    February 1, 2020 at 2:00 am

    Hey Matthias,

    thanks for the post, very useful stuff!

    I just noticed a little typo in you EaseInOut function, or it might be an issue with the HTML characters. I believe it should be written as follows :

    EaseInOut = function(power){return function(t){return t < 0.5 ? EaseIn(power)(t*2)/2 : EaseOut(power)(t*2 – 1)/2+0.5}};

    Thanks again!

    EaseInOut = function(power){return function(t){return t &lt; 0.5 ? EaseIn(power)(t*2)/2 : EaseOut(power)(t*2 - 1)/2+0.5}};

  • Obed Ampong

    February 20, 2020 at 7:22 pm

    Thanks a lot.



  • Owen Rucker

    April 8, 2020 at 11:47 pm

    Is there a way to create an easing function formula based off the Bezier values seen in the FLOW plugin?

    eg: [0.40,0.00,0.20,1.00]

    Sorry, I don’t know the math.

Page 1 of 2

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