Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Small jump in size after time mark is passed

  • Small jump in size after time mark is passed

    Posted by David Cabestany on March 31, 2020 at 9:07 pm

    I’m applying the following expression to generate some scale trails with some layers.

    I need to come as 1,2,3 and then leave 3,2,1.

    This expression sort of works, however when the needle goes past 1 second the 3rd layer (the 2nd trailer) jumps its scale from 100 to 100.8. The layer above does not change.

    I get an expression error warning from 1 second to 2 seconds and then it goes away.
    The expression works despite the error warning except for the .8% jump in size.

    Any help is greatly appreciated

    delay = thisComp.layer("xp").effect("d")("Slider")

    t=time;
    d = delay*thisComp.frameDuration*(index - 1);
    if
    (t<1)
    {
    s=thisComp.layer(6).scale.valueAtTime(time - d)
    }

    if
    (t>2)
    {
    s=thisComp.layer(6).scale.valueAtTime(time + d)
    }
    s;

    Dan Ebberts replied 6 years, 1 month ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    March 31, 2020 at 9:52 pm

    For starters, you don’t define what s is when t is between 1 and 2. I’d set it up like this:


    if (t < 1){
    s = // value when t less than 1
    }else if (t <= 2){
    s = // value when t between 1 and 2
    }else{
    s = // value when t > 2
    }
    s

    I’m not sure that’s the only issue, but it should help…

    Dan

  • David Cabestany

    March 31, 2020 at 10:41 pm

    Thanks Dan, that helped, but the expression seems convoluted, could a while statement work in here or it will crash the program?

  • Dan Ebberts

    March 31, 2020 at 10:48 pm

    I don’t think while will help, but what exactly are you trying to do?

    Dan

  • Dan Ebberts

    March 31, 2020 at 11:09 pm

    One problem you might be having is that there will be discontinuities at 1 and 2 seconds, where the amount of delay changes abruptly. You might want to ease through those changes with something like this (not tested at all):


    easeTime = .25;
    delay = thisComp.layer("xp").effect("d")("Slider");
    t=time;
    d = delay*thisComp.frameDuration*(index - 1);
    if (t < 2){
    dly = ease(t,1-easeTime,1,-d,0);
    }else{
    dly = ease(t,2,2+easeTime,0,d);
    }
    thisComp.layer(6).scale.valueAtTime(time + dly)

    Dan

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