ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

position Y loop issue

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Miguel Alva
position Y loop issue
on May 25, 2017 at 11:05:01 am


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!


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

Return to posts index

Steve Sierra
Re: position Y loop issue
on May 26, 2017 at 12:03:26 pm


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

a = thisComp.height;
t = 4;

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

[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 !

Return to posts index

Miguel Alva
Re: position Y loop issue
on May 27, 2017 at 6:56:45 am

Thank you!

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

Return to posts index

Steve Sierra
Re: position Y loop issue
on May 27, 2017 at 8:38:55 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 !

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved