ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Converting Robert Penner's easing into expressions

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Amir Aizat
Converting Robert Penner's easing into expressions
on Dec 29, 2017 at 10:53:02 am
Last Edited By Amir Aizat on Jan 3, 2018 at 10:20:04 am

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 1

var startDuration = inPoint + transition; // 1
var actualDuration = startDuration + duration + transition; // 3
var endDuration = actualDuration - transition; // 2

var 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.


Return to posts index

Amir Aizat
Re: Converting Robert Penner's easing into expressions
on Jan 4, 2018 at 12:40:31 pm

I found the problem. Posting the solution for people who's had the same issue

instead of
function smoothEaseIn(startTime, endTime, startVal, endVal) {
var x = easeInQuint(time - startTime, 0, 100, transition);
return linear(x, <b>startTime, endTime,</b> startVal, endVal);
}

function smoothEaseOut(startTime, endTime, startVal, endVal) {
var x = easeOutQuint(time - startTime, 0, 100, transition);
return linear(x, <b>startTime, endTime,</b> startVal, endVal);
}


it should be
function smoothEaseIn(startTime, endTime, startVal, endVal) {
var x = easeInQuint(time - startTime, 0, 100, transition);
return linear(x, <b>0, 100,</b> startVal, endVal);
}

function smoothEaseOut(startTime, endTime, startVal, endVal) {
var x = easeOutQuint(time - startTime, 0, 100, transition);
return linear(x, <b>0, 100,</b> startVal, endVal);
}


Stupid mistake on my part, I can't believe I missed that!


Return to posts index

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