Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions position Y loop issue

  • position Y loop issue

    Posted by Miguel Alva on May 25, 2017 at 11:05 am

    Hello,

    I am new to this forum. Nice to e-meet you.

    I had look for this answer and I can’t find a solution.

    I have this code:

    I have a shape layer. I want this layer to scroll from the top to the bottom and reset its position to top again when is out of the screen.

    I have this code and it doesn’t work. Can you help me? Thank you!

    X=position[0];
    Y=position[1];

    if (Y <= thisComp.height)
    {
    [X,Y*time];
    } else {
    [X,Y - 200];
    }

    Steve Sierra replied 8 years, 11 months ago 2 Members · 3 Replies
  • 3 Replies
  • Steve Sierra

    May 26, 2017 at 12:03 pm

    Hi,

    I think this works (t is the Y animation duration in seconds):

    X=position[0];
    Y=position[1];
    a = thisComp.height;
    t = 4;

    [X,linear(t, -a/2, (1.5*a*time/t)-((a/(2*t))*(t-time)))];

    if(time>=t){
    [X, -a/2]
    };

    Here’s what I think is going on :
    I first wanted to put a linear interpolation and then check the time to send it back to it’s original position.
    Since the final value is in an if statement, it recalculates the value every frame, so a simple linear doesn’t work.
    I then noticed that it was tacking the last value of the linear interpolation in account.
    So I modified that final destination value to “fit” the animation…

    Hope this helps !
    😉

  • Miguel Alva

    May 27, 2017 at 6:56 am

    Thank you!

    I am trying to do a delay using index as multiplier. But no success.

  • Steve Sierra

    May 27, 2017 at 8:38 am

    Hi again,

    What you can do, is make a master layer with the expression on it, hide it if you want.
    Then, you put this expression on the other layers position property :

    a = 3;
    thisComp.layer(“Main”).transform.position.valueAtTime(time-thisLayer.index * a);

    by changing “a”, you change the delay ????

    Hope this helps,

    Cheers !

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