Forum Replies Created

  • Jacob Mellin

    September 21, 2021 at 8:06 pm in reply to: Custom speeds when easing via expression ease(t,a,b,x,y)

    Hi Dagur, if you’re using Matthias’ Script, you should just be able to remove the mention of the y parameter and read in and return the computation for the single value, like so:

    EaseOut = function(power){return function(t){return 1 - Math.abs(Math.pow(t-1, power))}};

    dur=3; power=5; //1=linear, 2=Quad, 3=Cubic, 4=Quart, 5=Quint

    startValue=value;

    endValue= 100;

    t=linear(time-inPoint,0,dur,0,1);

    Exp=EaseOut(power)(t);

    computedValue=startValue+(endValue-startValue)*Exp;

    computedValue


  • Jacob Mellin

    September 7, 2018 at 10:22 pm in reply to: Custom speeds when easing via expression ease(t,a,b,x,y)

    Hi,

    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: https://gist.github.com/gre/1650294

    You could use https://easings.net/ 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))

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