Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Modifying expression times to layer’s inPoint

  • Modifying expression times to layer’s inPoint

    Posted by Adam Levine on March 14, 2016 at 6:51 pm

    Hello! I’ve a serious problem. How can I use ease wizz expression without adding keyframes. I want to set it for time such as layer’s inPoint to inPoint+2 like that. And I’ve used a slider controller to change the eX value of the expression. So I’ve tried so many ways to change the expression. But it didn’t work. Here is that how I changed the expression. Please help me anyone. Master Dan, I think you can give me an idea.

    // Ease and Wizz 2.0.3 : inExpo : 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_inExpo(t, b, c, d) {
    return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + 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_inExpo(t, sX, eX, d, a, p, s);
    switch (dim) {
    case 1:
    return val1;
    break;
    case 2:
    val2 = easeandwizz_inExpo(t, sY, eY, d, a, p, s);
    return [val1, val2];
    break;
    case 3:
    val2 = easeandwizz_inExpo(t, sY, eY, d, a, p, s);
    val3 = easeandwizz_inExpo(t, sZ, eZ, d, a, p, s);
    return [val1, val2, val3];
    break;
    default:
    return null;
    }
    }
    }

    (easeAndWizz() || value);

    changed to :

    t = time - inPoint;
    d = inPoint+2 - inPoint;

    sX = 960;
    eX = 960 - thisComp.layer("ctrl").effect("Value")(1);

    if (dim >= 2) {
    sY = 380;
    eY = 380;

    if (dim >= 3) {
    sZ = 0;
    eZ = 0;
    }
    }

    Adam Levine replied 10 years, 4 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    March 14, 2016 at 7:59 pm

    Something like this maybe:


    v1 = value;
    v2 = effect("Slider Control")("Slider");
    t1 = inPoint;
    t2 = inPoint + 2;
    if (time < t1)
    v1
    else if (time > t2)
    v2
    else{
    d = t2 - t1;
    dv = v2 - v1;
    t = (time - t1)/d;
    v1 + dv*Math.exp(10*(t-1));
    }

    Dan

  • Adam Levine

    March 14, 2016 at 9:17 pm

    First thank you master Dan for your quick reply. So I changed the expression like this as you said. But it’s not working. 🙁 Sorry for asking. Can you give me a another idea please.

    // Ease and Wizz 2.0.3 : inExpo : 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_inExpo(t, b, c, d) {
    return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + 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) {}

    sX = value[0];
    eX = thisComp.layer("ctrl").effect("Value")(1);
    t1 = inPoint;
    t2 = inPoint + 2;
    if (time < t1)
    v1
    else if (time > t2)
    v2
    else{
    d = t2 - t1;
    dv = eX - sX;
    t = (time - t1)/d;
    v1 + dv*Math.exp(10*(t-1));
    }

    if (dim >= 2) {
    sY = value[1];
    eY = value[1];

    if (dim >= 3) {
    sZ = value[2];
    eZ = value[2];
    }
    }
    if ((time < key1.time) || (time > key2.time)) {
    return value;
    } else {
    val1 = easeandwizz_inExpo(t, sX, eX, d, a, p, s);
    switch (dim) {
    case 1:
    return val1;
    break;
    case 2:
    val2 = easeandwizz_inExpo(t, sY, eY, d, a, p, s);
    return [val1, val2];
    break;
    case 3:
    val2 = easeandwizz_inExpo(t, sY, eY, d, a, p, s);
    val3 = easeandwizz_inExpo(t, sZ, eZ, d, a, p, s);
    return [val1, val2, val3];
    break;
    default:
    return null;
    }
    }
    }

    (easeAndWizz() || value);

  • Dan Ebberts

    March 14, 2016 at 9:51 pm

    That wasn’t meant to be a modification to your expression, it’s an example of a non-keyframed expoIn expression.

    Dan

  • Adam Levine

    March 15, 2016 at 5:40 am

    Thank you for your gratitude master Dan. But sorry asking again. Can give me an idea to modify my expression please.

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