FORUMS: list search recent posts

How to call for a value before expression?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Simon Björk
How to call for a value before expression?
on Dec 30, 2010 at 10:05:59 am

I'm trying to reposition a camera to start at z-position 0.

For example, I have a camera that has a position of [960,549,-8000].

I want to move the z-position to 0, so I add the following expression "position + [0,0,transform.position[2]*-1]". I can't call the actual value, becuse this expression will be a part of an autumated process and the camera position will be different for different projects. All this works perfectly, but I have some other obects that I want to move the same ammount. For example, I have a null at z-position 10, and would like to move that the same ammount as the camera (which would give me a value of 8010 in this example.

I tried with the following expression to the null: "position + [0,0,thisComp.layer("Camera 1").transform.position[2]]", but that doesn't work since the cameras z-position has been moved to 0 already. So I must call the cameras original z-position somehow. Is this possible?


Return to posts index

Chris Wright
Re: How to call for a value before expression?
on Dec 30, 2010 at 6:28:40 pm

put this in null position.

r=thisComp.layer("Camera 1").transform.position.valueAtTime(effect("Slider Control")("Slider"));

value+[0,0,r[2]];

http://technicolorsoftware.hostzi.com/


Return to posts index

Simon Björk
Re: How to call for a value before expression?
on Dec 30, 2010 at 8:24:45 pm

Thank you for your reply Chris, but nothing happens with that expression, even if I add a slider to the null. Am I supposed to change any values?


Return to posts index


Dan Ebberts
Re: How to call for a value before expression?
on Dec 30, 2010 at 8:29:44 pm

Try this little trick. Change your camera's expression to this:

if (time < 0)
value
else
position + [0,0,transform.position[2]*-1];


and the null's expression to this:


position + [0,0,thisComp.layer("Camera 1").transform.position.valueAtTime(-1)[2]]


Dan



Return to posts index

Simon Björk
Re: How to call for a value before expression?
on Jan 4, 2011 at 9:35:25 am

Hi Dan, thanks for your reply.

I don't get your expression to work either.

It does change the nulls position correctly if I change your "position + [0,0,thisComp.layer("Camera 1").transform.position.valueAtTime(-1)[2]]" to position + "[0,0,thisComp.layer("Camera 1").transform.position.valueAtTime(-1)[2]*-1]".

However, I I want to animate my camera, I can't. If I use the z-slider, it just moves the null and snap back to position 0.

Any ideas?


Return to posts index

Dan Ebberts
Re: How to call for a value before expression?
on Jan 4, 2011 at 4:05:03 pm

Ah, OK. I didn't understand that you were animating the camera. Try it this way:

camera:

if (time < 0)
valueAtTime(-time)
else
position + [0,0,transform.position[2]*-1];


null:

position + [0,0,thisComp.layer("Camera 1").transform.position.valueAtTime(-time)[2]]



Dan



Return to posts index

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