Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Position expression won’t animate

  • Position expression won’t animate

    Posted by Ben Robinson on February 25, 2013 at 12:13 pm

    I’m pretty green when it comes to expressions–pickwhipping, with the odd adaptation / adjustment, is about the extent of my knowhow. That said, I thought that what I’m trying to do should be a pretty straightforward manoeuvre. Seems I was wrong…

    I’m trying to link the position property of a layer in one comp to that of a null in another comp. I’ve applied the following expression:

    comp(“Comp Name”).layer(“Layer Name”).transform.position

    To confirm, I pickwhipped from one comp to the other, getting the exact same expression. All seems fine. Changing the position of the null in my main comp updates the position of the layer in the other comp. When I animate the null position, however, the layer in the other comp does not respond: it’s only being affected by the null’s position in one instance, not multiple positions / keyframes. I thought perhaps it was just a “glitch”, so I’ve rebooted, etc. No change.

    Any thoughts / help much appreciated.

    NB – might be worth noting that the two comps are different in size: my main comp is 1920×1080 and the other comp (which itself is nested in another 1920×1080 comp inside the main comp) is a whopping 8000×7000, containing a large, hi res image that I want to move around in the background in my main comp. I set the null position to (4000, 3500) to match the image’s initial position before linking them.

    Victor Lavrenko replied 11 years, 4 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    February 25, 2013 at 3:44 pm

    You can run into this if the comp of the layer that’s not responding is nested inside the comp with the null, AND the nested comp doesn’t start at time zero. If that’s the case in your situation, you need to compensate for the time offset, like this:

    C = comp(“Comp Name”);
    L = C.layer(thisComp.name);
    C.layer(“Layer Name”).transform.position.valueAtTime(time+L.startTime)

    Dan

  • Ben Robinson

    February 26, 2013 at 10:04 am

    Thanks for your reply Dan. I’ve been agonising over this and wasting WAY TOO MUCH time trying to work it out. I was convinced there was an error in my system. Makes perfect sense now that you’ve explained the time offset factor–although I never would have got there myself.

    I’ve applied your time compensation expression to the position property of the layer in my nested comp as follows:

    C = comp(“Main Comp”);
    L = C.layer(thisComp.name);
    C.layer(“Null”).transform.position.valueAtTime(time+L.startTime)

    I’m getting an error in Line 2: “Bad argument: couldn’t find layer named “Nested Layer”. I can see what’s going on here: it’s looking for a layer with the name of my nested comp // layer(thisComp.name) // inside my main comp (given the variable “C”), which obviously doesn’t exist. Is this correct? Have I mixed up which comp / layer names to insert in the “Comp Name” / “Layer Name” positions?

  • Ben Robinson

    February 26, 2013 at 10:23 am

    Ok. I worked out that, because the layer I want to control is nested in a nested comp, I had to alter your expression somewhat and add another variable as such:

    C = comp(“Main Comp”);
    C2 = comp(“Sub Comp”);
    L – C2.layer(thisComp.name);
    C.layer(“Null”).transform.position.valueAtTime(time+L.startTime)

    Works a treat. I’m reasonably pleased with myself for working that out–but all credit goes to you Dan.

    Thanks very much.

  • Victor Lavrenko

    January 18, 2015 at 9:58 am

    Thank you Ben and Dan! My solution is as follows:

    C1 = comp(“Sub comp”).layer(“name”);
    L1 = comp(“Main comp”).layer(“Sub comp layer name in Main comp”);
    C1.transform.position.valueAtTime((time-.3)-(L1.startTime));

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