Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Combining Ease and Wizz with another expression

  • Combining Ease and Wizz with another expression

    Posted by Chiara Morlacchi on April 3, 2014 at 9:15 am

    Hi everybody,
    and thanks for all your work! Thanks to this forum i could learn a lot about expressions and resolve a lot of issues by checking through all your post.

    But now is time for me to post my own issue:
    I would like to combine an expression i wrote with the ease and wizz expression.
    Basicly, I’m doing a sort of a template where i have this expression that scale the x value of a layer based on the value I put in a Null and according to his own keyframes.
    I need to add the ease and wizz to this two keyframes (inOutQuint), but if i do it throught the script ease and wizz, my expression stops working.
    I know it can’t work by pasting the ease and wizz expression below mine, but i have no idea how to combine them!
    Can anybody help me with this?
    Thanks a lot!

    MY EXPRESSION:

    yScale = 100;
    xScaleZero = 0;
    xScaleMask = thisComp.layer(“SCALE LINES”).transform.scale[0];
    min = [xScaleZero,yScale];
    max = [xScaleMask,yScale];
    t1 = key(1).time;
    t2 = key(2).time
    if (time<=t1) min;
    else if (time>t1 && timeEASE AND WIZZ:

    // Ease and Wizz 2.0 : inOutQuint : All keyframes
    // Ian Haigh (https://ianhaigh.com/easeandwizz/)
    // Last built: 2009-01-08T11:11:54+11:00
    // some defaults
    var p = 0.8; // period for elastic
    var a = 50; // amplitude for elastic
    var s = 1.70158; // overshoot amount for "back"
    function inOutQuint(t, b, c, d, a, p) {
    if ((t/=d/2) &lt; 1) return c/2*t*t*t*t*t + b;
    return c/2*((t-=2)*t*t*t*t + 2) + b;
    }
    function easeAndWizz() {

    var n = 0;
    if (numKeys > 0) {
    n = nearestKey(time).index;
    if (key(n).time > time) { n– }
    }
    try {
    var key1 = key(n);
    var key2 = key(n+1);
    } catch(e) {
    return null;
    }

    // determine how many dimensions the keyframes need
    var dim = 1; // It’s gotta have at least ONE dimension
    try {
    key(1)[1];
    dim = 2;
    key(1)[2];
    dim = 3;
    } catch(e) {}
    t = time – key1.time;
    d = key2.time – key1.time;
    sX = key1[0];
    eX = key2[0] – key1[0];
    if (dim >= 2) {
    sY = key1[1];
    eY = key2[1] – key1[1];
    if (dim >= 3) {
    sZ = key1[2];
    eZ = key2[2] – key1[2];
    }
    }
    if ((time &lt; key1.time) || (time > key2.time)) {
    return value;
    } else {
    val1 = inOutQuint(t, sX, eX, d, a, p, s);
    switch (dim) {
    case 1:
    return val1;
    break;
    case 2:
    val2 = inOutQuint(t, sY, eY, d, a, p, s);
    return [val1, val2];
    break;
    case 3:
    val2 = inOutQuint(t, sY, eY, d, a, p, s);
    val3 = inOutQuint(t, sZ, eZ, d, a, p, s);
    return [val1, val2, val3];
    break;
    default:
    return null;
    }
    }
    }
    (easeAndWizz() || value);

    Chiara Morlacchi replied 12 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Jason Jantzen

    April 4, 2014 at 3:20 pm

    You should look into the Animation Patterns script. I think that one can combine multiple “patterns” or animations all referenced with expressions on the same parameter. Free version https://aescripts.com/animationpatterns/

    Pro version https://aescripts.com/animationpatternspro/

    Jason Jantzen
    vimeo.com/jasonj

  • Chiara Morlacchi

    April 4, 2014 at 4:05 pm

    Thank you very much Jason!
    Actually I just spent all afternoon rewriting the entire expression (combining the two)
    and at the end it worked! (i’m very surprised!)
    But thanks anyway for your advice, i’ll have a look in case of any other evenience!

    If anyone could ever need it, it’s this:

    yScale = 100;
    xScaleZero = 0;
    xScaleMask = thisComp.layer("SCALE LINES").transform.scale[0];
    min = [xScaleZero,yScale];
    max = [xScaleMask,yScale];
    t1 = key(1).time;
    t2 = key(2).time;

    // Ease and Wizz 2.0 : outQuint : All keyframes
    // Ian Haigh (https://ianhaigh.com/easeandwizz/)
    // Last built: 2009-01-08T11:11:54+11:00
    // some defaults

    var p = 0.8; // period for elastic
    var a = 50; // amplitude for elastic
    var s = 1.70158; // overshoot amount for "back"
    function outQuint(t, b, c, d, a, p) {
    return c*((t=t/d-1)*t*t*t*t + 1) + b;
    }

    function easeAndWizz() {

    var dim = 2;
    t = time - t1;
    d = t2 - t1;
    sX = 0;
    eX = xScaleMask - 0;
    sY = 100;
    eY = 100 - 100;

    if (time &lt; t1) {
    return min;
    }
    if (time > t2) {
    return max;
    } else {
    val1 = outQuint(t, sX, eX, d, a, p, s);
    switch (dim) {
    case 1:
    return val1;
    break;
    case 2:
    val2 = outQuint(t, sY, eY, d, a, p, s);
    return [val1, val2];
    break;
    default:
    return null;
    }
    }
    }
    (easeAndWizz() || value);

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