Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Combining Expressions

  • Combining Expressions

    Posted by Adam Levine on February 28, 2015 at 6:39 pm

    I’ve a layer with position key frames and I used for them Ease and Wizz script. But like in the picture I also want to link that first two keyframes to “INPOINT” Marker and last two keyframes to “OUTPOINT” marker..

    I have a custom expression for link key frames to that markers… But that expression won’t work with Ease and Wizz script…

    I need to combined them for one expression…

    here is my custom expression

    L = thisComp.layer(“layer 01”);
    if ((L.marker.numKeys > 1 ) && (numKeys > 3)){
    dIn = key(2).time – key(1).time;
    dOut = key(4).time – key(3).time;
    tIn = L.marker.key(1).time;
    tOut = L.marker.key(2).time;
    if (time < L.marker.key(2).time)
    linear(time,tIn-dIn,tIn,key(1).value,key(2).value)
    else
    linear(time,tOut,tOut+dOut,key(3).value,key(4).value);
    }else
    value

    Ease and Wizz script

    // Ease and Wizz 2.0.3 : inOutExpo : All keyframes
    // Ian Haigh (https://ianhaigh.com/easeandwizz/)
    // Last built: 2012-10-11T16:37:31+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 easeandwizz_inOutExpo(t, b, c, d) {
    if (t==0) return b;
    if (t==d) return b+c;
    if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t – 1)) + b;
    return c/2 * (-Math.pow(2, -10 * –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 < key1.time) || (time > key2.time)) {
    return value;
    } else {
    val1 = easeandwizz_inOutExpo(t, sX, eX, d, a, p, s);
    switch (dim) {
    case 1:
    return val1;
    break;
    case 2:
    val2 = easeandwizz_inOutExpo(t, sY, eY, d, a, p, s);
    return [val1, val2];
    break;
    case 3:
    val2 = easeandwizz_inOutExpo(t, sY, eY, d, a, p, s);
    val3 = easeandwizz_inOutExpo(t, sZ, eZ, d, a, p, s);
    return [val1, val2, val3];
    break;
    default:
    return null;
    }
    }
    }

    (easeAndWizz() || value);

    can ayone help me… thank you very much…

    Adam Levine replied 11 years, 5 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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