FORUMS: list search recent posts

X position based on Y (kind of)

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mike Olson
X position based on Y (kind of)
on Aug 21, 2011 at 7:36:52 pm

I have about 50 postage stamp sized images all stacked vertically in a row. I need to scroll these images vertically very quickly and at the same time, as each image enters the center of the comp, they (each image in turn) need to shift to the left by 35 pixels or so, then back into position. The end effect should look like a sorting machine examining each image (only very fast).

At the moment, I have all the images aligned in one comp. I have tried attaching them to a null to get the vertical movement and added keyframes to each image for the horizontal move, but it's too difficult to keep when the horizontal move happens at the same location in the comp as the vertical move (the null) must ease out and in, thereby throwing off when each image shifts horizontally.

I am stumped as to how to go about it so any help would be greatly appreciated, thanks in advance!


Return to posts index


Dan Ebberts
Re: X position based on Y (kind of)
on Aug 21, 2011 at 8:36:45 pm

As an example, this should ease your stamp 35 pixels to the left as it goes from 5 pixels below the center of the comp to 5 pixels above.


range = 5;
shift = -35;

p = toComp(anchorPoint);
d = thisComp.height/2- p[1];
if (d < 0)
x = ease(d,-range,0,0,shift)
else
x = ease(d,0,range,shift,0);
value + x



Dan



Return to posts index

Mike Olson
Re: X position based on Y (kind of)
on Aug 21, 2011 at 8:59:44 pm

You, sir, are brilliant! Your expression REALLY helps me out.

Thank you for being so generous with your time and knowledge. Not to mention your patience in dealing with lost souls like myself.

I am so very grateful!!


Return to posts index


Mike Olson
Re: X position based on Y (kind of)
on Aug 21, 2011 at 9:06:39 pm

You, sir, are brilliant! Your expression REALLY helps me out.

Thank you for being so generous with your time and knowledge. Not to mention your patience in dealing with lost souls like myself.


Return to posts index

Mike Olson
Re: X position based on Y (kind of)
on Aug 22, 2011 at 1:16:17 am

Sorry for the double post...

Now I'm going to be selfish and ask for a variation:

What if the images where positioned horizontally and I needed to have the images move up (or down) in the same fashion (as they moved from right or left)?

I'm attempting to rework your code, but I'm not have any success.

Once again, thank you in advance.


Return to posts index

Dan Ebberts
Re: X position based on Y (kind of)
on Aug 22, 2011 at 4:30:51 am

This should work for up:


range = 5;
shift = 35;
p = toComp(anchorPoint);
d = thisComp.width/2- p[0];
if (d < 0)
y = ease(d,-range,0,shift,0)
else
y = ease(d,0,range,0,shift); value + [0,y]


For down, just change shift to -35.

Dan



Return to posts index


Mike Olson
Re: X position based on Y (kind of)
on Aug 22, 2011 at 6:49:09 pm

Excellent! Thank you so much.


Return to posts index

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