FORUMS: list search recent posts

# change direction on comp frame end

FAQ   •   VIEW ALL
 change direction on comp frame end on Dec 8, 2011 at 9:23:57 pm

Hi. For the life of mine I cannot figure out some simple expression. Here's what I need to do.

I have object on the top left side of the screen. I need it to move every 10 pixels to the opposite side on top right. Then go down 10 frames and move back to left side. And so on.

At the end it should look like it's traveling from left to right, when hits the frame it goes to second line and moves from right to left, when hits frame on left it starts to move to the right.... and so on.

Please, can some one help me with this? I know it's pretty simple, but cannot figure out.
I tried searching the forum with no success as I cannot figure out my question:)

 Re: change direction on comp frame endon Dec 8, 2011 at 9:51:13 pm

>I need it to move every 10 pixels...

Do you mean you want it to move in 10-pixel increments? How often, or at what rate?

>when hits the frame it goes to second line...

Do you mean you want it to instantly drop down the height of the layer and start back in the other direction?

Dan

 Re: change direction on comp frame endon Dec 9, 2011 at 6:55:35 am

Picture talks in thousand words. Please see this link to understand what I mean:

And yes, I wan it to move every 10 pixels every second or so.

Thank you.

 Re: change direction on comp frame endon Dec 9, 2011 at 5:13:36 pm

I think this is what you're asking for, although I'll be surprised if it's actually what you want.

``` hTravel = 500; vTravel = height; period = 1; pixPerPeriod = 10; periodsPerRow = hTravel/pixPerPeriod; t = time - inPoint; nPeriods = Math.floor(t/period); nRows = Math.floor(nPeriods/periodsPerRow); nCols = nPeriods%periodsPerRow; if (nRows%2) value + [hTravel - nCols*pixPerPeriod,nRows*vTravel] else value + [nCols*pixPerPeriod,nRows*vTravel] ```

Set the value of hTravel to how far you want it to go before it starts a new line.

Dan