simple position and time offset not so simple

Moderators: Disciple, zlovatt

Post Reply
goodfear_la
Posts: 2
Joined: April 4th, 2006, 4:32 pm
Location: la ca
Contact:

hello,

new to expressions and i am trying to animate the position of a bunch of solid layers. i have my first solid and i set 2 keyframes for the position. i added an expression to my next solid layer and linked it to the position of my first solid and adding a transform of +300. this works fine but i would like to add an offset for the time so that the move happens 5 frames later.

every time i try to add a value for the time i get an error and it wont work.

here is my expression so far

thisComp.layer("Deep Red Solid 2").transform.position +300.

what do i need to do to make this happne 5 frames later? secondly if i add this same expression to the layer following that will the time and position of solid layer 3 be offset from solid layer 2 as long as i specify that layer in the ("layer") variable?

thanks in advance for your help and suggestions.
goodfear_la
Posts: 2
Joined: April 4th, 2006, 4:32 pm
Location: la ca
Contact:

played around with this some more and here is where i ended up

x = thisComp.layer("Solid_1").position[0] + 22;
y = thisComp.layer("Solid_1").position.valueAtTime(time-0.03)[1];
[x,y]

seems to work ok. not sure it this is the best way to do this?
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

The expression you came up will offset the x position by 22 pixels and delay the y position of the solid. Is that what you were wanting? Take a look at this expression. Each layer references the one below it. Each time you duplicate the layer the new one will base its timing and position off the next one under it. An even better way to handle the variables is to put Expression Sliders on the animating solid. Then pick whip the slider value while you have your variable selected ("2" for example). This way you can control how far apart they lag and offset.

Code: Select all

frameOffset = 2;
xOffset = 20;
yOffset = 20;
offset = frameOffset * thisComp.frameDuration;
pos = thisComp.layer(index + 1).position;
xPos =pos.valueAtTime(time - offset)[0] + yOffset;
yPos = pos.valueAtTime(time - offset)[1] + yOffset;

[xPos,yPos]
Post Reply