-
Converting Robert Penner’s easing into expressions
Hi,
I’m having problems making Robert Penner’s easing work with After Effects:
function easeInQuint(t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
}easeInQuint(time - inPoint, [0,0], [100, 100], inPoint + 1);
It kept moving indefinitely, not stopping at [100, 100] or inPoint + 1.
function easeInQuint(t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
}x = easeInQuint(0, 0, 1, 1);
linear(x, [0,0], [100, 100])
This doesn’t respond at all.
What did I do wrong for this expression? My goal is to use this as a replacement for boring ease() / easeIn() / easeOut() interpolation.
EDIT:
I managed to make it somewhat work, but I don’t understand it completely yet. The full expression is:
var comp = thisComp;
var duration = comp.layer("Duration").text.sourceText;
var transition = comp.layer("Transition").text.sourceText;duration = parseFloat(duration); // testing at 1
transition = parseFloat(transition); // testing at 1var startDuration = inPoint + transition; // 1
var actualDuration = startDuration + duration + transition; // 3
var endDuration = actualDuration - transition; // 2var startPos = [0, 0];
var endPos = [960, 0];if (time <= (inPoint + actualDuration) / 2) { smoothEaseOut(inPoint, startDuration, startPos, endPos); // 0, 1, [0, 0], [960, 0] } else { smoothEaseIn(endDuration, actualDuration, endPos, startPos); // 2, 3 [960, 0], [0, 0] } function easeOutQuint(t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; } function easeInQuint(t, b, c, d) { return c*(t/=d)*t*t*t*t + b; } function smoothEaseIn(startTime, endTime, startVal, endVal) { var x = easeInQuint(time - startTime, 0, 1, transition); return linear(x, startTime, endTime, startVal, endVal); } function smoothEaseOut(startTime, endTime, startVal, endVal) { var x = easeOutQuint(time - startTime, 0, 1, transition); return linear(x, startTime, endTime, startVal, endVal); }
The transition and duration are supposed to be adjustable by keying in time in seconds in Premiere Pro's live text template settings, and the entire things worked properly with normal ease, or when I use ease within ease multiple times (not sure what that technique is called).
With the quint easing function, transition and duration changes break the curves, and animation out isn't working at all. Any help would be greatly appreciated.
EDIT:
Graph for reference
Thank you.