ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Tilman Commes
Custom speeds when easing via expression ease(t,a,b,x,y)
on Jun 13, 2017 at 10:47:29 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!
Tilman


Return to posts index

Dan Ebberts
Re: Custom speeds when easing via expression ease(t,a,b,x,y)
on Jun 13, 2017 at 4:45: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.

Dan



Return to posts index

Tilman Commes
Re: Custom speeds when easing via expression ease(t,a,b,x,y)
on Jun 14, 2017 at 9:33:31 am

Thanks for the reply!
I will look into that!


Return to posts index


Matt Volp
Re: Custom speeds when easing via expression ease(t,a,b,x,y)
on Sep 3, 2018 at 2:33:22 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!

Cheers.


Return to posts index

Tilman Commes
Re: Custom speeds when easing via expression ease(t,a,b,x,y)
on Sep 6, 2018 at 10:53:37 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?


Return to posts index

James Ronan
Re: Custom speeds when easing via expression ease(t,a,b,x,y)
on Sep 6, 2018 at 2:45:14 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:
https://gist.github.com/gre/1650294

Hope that helps


Return to posts index


Jacob Mellin
Re: Custom speeds when easing via expression ease(t,a,b,x,y)
on Sep 7, 2018 at 10:22:50 pm
Last Edited By Jacob Mellin on Sep 8, 2018 at 11:14:56 am

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))


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]