FORUMS: list search recent posts

change direction on comp frame end

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Tomas Sinkunas
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:)

Appreciate your time. Thanks.


Return to posts index

Dan Ebberts
Re: change direction on comp frame end
on 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



Return to posts index

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

Picture talks in thousand words. Please see this link to understand what I mean:
http://www.rendertom.com/downloads/pic.jpg.

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


Thank you.


Return to posts index



Dan Ebberts
Re: change direction on comp frame end
on 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



Return to posts index

Tomas Sinkunas
Re: change direction on comp frame end
on Dec 9, 2011 at 5:23:36 pm

Wow, Dan. This is EXACTLY I was looking for. Than you for your help.
Still I have to tweak it a little to work the way I need it, but your input is SUPER GREAT, thank you. At least I can take it bit by bit apart and study it. Thank you once again.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]