Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions expression combined with ease and wizz

  • expression combined with ease and wizz

    Posted by Alfred Timotei on February 7, 2015 at 9:58 pm

    Hello, I’m trying to combine the expression bellow with the out expo from ease and wizz script and I don’t succeed. Any idea how to do this to work?

    -l is the length of the in and out transition
    -0.034 is needed because I have 29.97fps, and if I don’t put there the animation won’t finish
    -the out animation is needed to finish 10 frames early than the outPoint
    -the main idea is to replace the easeOut function with the outExpo

    -the in animation is working (not exactly like the ease and wizz, but is ok) but the out animation don’t finish on time (outPoint-0.33), instead is finish at around outPoint+0.6

    -below are all 3 codes: my initial code, ease and wizz, the code I’m trying to build

    \\my code

    l=thisComp.layer("Animation Master").effect("Slider Control")("Slider");
    op = thisLayer.outPoint-0.034;
    if (0==0){
    v1i = value;
    if (effect("Checkbox Control 5")("Checkbox")==1) {v1 = v1i + [-1920,0]} else if (effect("Checkbox Control 6")("Checkbox")==1) {v1 = v1i + [1920,0]} else if (effect("Checkbox Control 7")("Checkbox")==1) {v1 = v1i + [0,-1080]} else if (effect("Checkbox Control 8")("Checkbox")==1) {v1 = v1i + [0,1080]} else v1 = v1i;
    v2 = value;
    v3 = value;
    v4i = value;
    if (effect("Checkbox Control 9")("Checkbox")==1) {v4 = v4i + [-1920,0]} else if (effect("Checkbox Control 10")("Checkbox")==1) {v4 = v4i + [1920,0]} else if (effect("Checkbox Control 11")("Checkbox")==1) {v4 = v4i + [0,-1080]} else if (effect("Checkbox Control 12")("Checkbox")==1) {v4 = v4i + [0,1080]} else v4 = v4i ;

    t1 = thisLayer.inPoint;
    t2 = t1+l;
    t3 = op-l-0.33;
    t4 = op-0.33;

    if (time < t2)
    easeOut(time,t1,t2,v1,v2)
    else if ((time > t3) || (time > op-(t4-t3)))
    easeOut(time,t3,t4,v3,v4)
    else
    value;
    }else
    value

    \\ease and wizz code

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

    (easeAndWizz() || value);

    \\the code I'm trying to build

    function easeandwizz_outExpo(t, b, c, d) {
    return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
    }

    var l=thisComp.layer("Animation Master").effect("Slider Control")("Slider");
    var op = thisLayer.outPoint-0.034;

    var v1i = value;
    if (effect("Checkbox Control 5")("Checkbox")==1) {var v1 = v1i + [-1920,0]} else if (effect("Checkbox Control 6")("Checkbox")==1) {var v1 = v1i + [1920,0]} else if (effect("Checkbox Control 7")("Checkbox")==1) {var v1 = v1i + [0,-1080]} else if (effect("Checkbox Control 8")("Checkbox")==1) {var v1 = v1i + [0,1080]} else var v1 = v1i;
    var v2 = value;
    var v3 = value;
    var v4i = value;
    if (effect("Checkbox Control 9")("Checkbox")==1) {var v4 = v4i + [-1920,0]} else if (effect("Checkbox Control 10")("Checkbox")==1) {var v4 = v4i + [1920,0]} else if (effect("Checkbox Control 11")("Checkbox")==1) {var v4 = v4i + [0,-1080]} else if (effect("Checkbox Control 12")("Checkbox")==1) {var v4 = v4i + [0,1080]} else var v4 = v4i;

    var t1 = thisLayer.inPoint;
    var t2 = t1+l;
    var t3 = op-l-0.33;
    var t4 = op-0.33;

    function easeAndWizz() {

    var tz=time-t1;
    var dz=l;
    var sXz=v1[0];
    var eXz=v2[0]-v1[0];
    var sYz=v1[1];
    var eYz=v2[1]-v1[1];

    var t=time-t3;
    var d=l;
    var sX=v3[0];
    var eX=v4[0]-v3[0];
    var sY=v3[1];
    var eY=v4[1]-v3[1];

    if (time <= t2) {
    val1 = easeandwizz_outExpo(tz, sXz, eXz, dz);
    val2 = easeandwizz_outExpo(tz, sYz, eYz, dz);
    return [val1, val2];
    }
    else if (time >= t3) {
    val1 = easeandwizz_outExpo(t, sX, eX, d);
    val2 = easeandwizz_outExpo(t, sY, eY, d);
    return [val1, val2];
    }

    }

    (easeAndWizz() || value);

    Alfred Timotei replied 11 years, 3 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