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