Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Dan Ebbert’s Squash and Stretch on marker not working correctly

  • Dan Ebbert’s Squash and Stretch on marker not working correctly

    Posted by Andrey Sibiryakov on September 8, 2012 at 9:32 pm

    Hello.

    I’ve combined two expressions one – Dan Ebbert’s Squash and Stretch.

    Only thing it is doing wrong – is doubling scale when assigned.
    Where is a mistake?

    Thanks in advance.

    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time){
    n--;
    }
    }

    if (n == 0){
    value;
    }else{
    max_dev=20; // max deviation in pixels
    spd=35; //speed of oscillation
    decay=10; //how fast it slows down
    t = time - marker.key(n).time;
    x = scale[0] + spd*Math.sin(max_dev*t*2*Math.PI)/Math.exp(decay*t);
    y = (1/x)*10000;
    value + [x,y];
    }

    Dan Ebberts
    replied 13 years, 7 months ago
    2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    September 9, 2012 at 1:02 am

    It looks to me like you’ve got spd and max_dev swapped. (spd should be inside Math.sin() and max_dev should be outside).

    Dan

  • Andrey Sibiryakov

    September 9, 2012 at 6:43 am

    Replaced values.
    Unfortunately, didn’t work.

  • Dan Ebberts

    September 9, 2012 at 7:09 am

    This works for me.

    Dan

    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time){
    n--;
    }
    }
    if (n == 0){
    value;
    }else{
    max_dev=20; // max deviation in pixels
    spd=35; //speed of oscillation
    decay=10; //how fast it slows down
    t = time - marker.key(n).time;
    x = scale[0] + max_dev*Math.sin(spd*t*2*Math.PI)/Math.exp(decay*t);
    y = (1/x)*10000;
    [x,y];
    }

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