Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Grab x,y,z and hold

  • Grab x,y,z and hold

    Posted by Brennanc on May 7, 2007 at 7:48 pm

    Just a simple request fellas. Is there a way that i can use an expression to grab just the initial x,y,z position of another animated layer and hold there until the end of the comp?

    Brennanc replied 18 years, 12 months ago 3 Members · 8 Replies
  • 8 Replies
  • Dan Ebberts

    May 7, 2007 at 8:49 pm

    This should do it:

    thisComp.layer(“other layer”).transform.position.valueAtTime(0)

    Dan

  • Mike Clasby

    May 7, 2007 at 9:17 pm

    OK, this seems to work, add the expression to the Slave’s position:

    thisComp.layer(“Master Layer”).position.valueAtTime(thisComp.layer(“Master Layer”).inPoint)

    It will take on the “Master Layer”‘s initial position, it’s inpoint position really, no matter how the two layers fall in the timeline. Obviously you can rename the “Master Layer” to whatever your layer name is.

    This expression can probably be shortened up, I’m just a hacker, kind like Dr Frankenstein taking bit’s and pieces from other’s expressions.

  • Mike Clasby

    May 7, 2007 at 9:19 pm

    Ooops, didn’t see you Dan, it took me awhile to work that one out.

  • Mike Clasby

    May 7, 2007 at 9:20 pm

    Dan, can my inPoint version be shortened?

  • Brennanc

    May 7, 2007 at 9:26 pm

    Thanks Dan, but i’ve noticed an oversight on my part. I’m trying to grab the x,y,z (which is under the position field) from a point light and apply it to my particular emitter. The problem is that in particular the x,y are on one field and z is on another (“position XY” and “position Z” respectively). So i tried pick-whipping from “position Z” to the just the z value of my light and added in “valueAtTime(0)” to look like this…

    thisComp.layer(“particle follow”).transform.position.valueAtTime(0)

    But i get an error “expression result must be of dimension 1, not 3”.

    Any thoughts?

  • Dan Ebberts

    May 7, 2007 at 9:28 pm

    The only thing I can think of would be to do it this way:

    L = thisComp.layer(“Master Layer”);
    L.position.valueAtTime(L.inPoint)

    Dan

  • Dan Ebberts

    May 7, 2007 at 9:29 pm

    Try it this way:

    thisComp.layer(“particle follow”).transform.position.valueAtTime(0)[2]

    Dan

  • Brennanc

    May 7, 2007 at 9:33 pm

    Works like a charm. Thanks Dan!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy