Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Can’t get xRotation value of another layer in After Effects

  • Can’t get xRotation value of another layer in After Effects

    Posted by Shaun Thomson on July 13, 2021 at 1:42 pm

    I have two layers – a leader and a follower.

    I’m successfully able to make the follower follow the leader with this expression in the follower’s Position property:

    src=thisComp.layer("Leader");
    delay = thisComp.layer("Leader").effect("Delay")("Slider"); 
    d = delay*thisComp.frameDuration*(index - 1);
    src.position.valueAtTime(time - d);
    

    I can also make it follow the leader’s orientation with this expression in the follower’s Orientation property:

    src=thisComp.layer("Leader");
    delay = thisComp.layer("Leader").effect("Delay")("Slider"); 
    d = delay*thisComp.frameDuration*(index - 1);
    src.orientation.valueAtTime(time - d);
    

    However, when I try to make the follower follow the leader’s xRotation with the following in the follower’s xRotation property, I get an error:

    src=thisComp.layer("Leader");
    delay = thisComp.layer("Leader").effect("Delay")("Slider"); 
    d = delay*thisComp.frameDuration*(index - 1);
    src.xRotation.valueAtTime(time - d);
    

    The error:

    Cannot read read property 'valueAtTime' of undefined
    

    The code works fine for the other properties – why not the xRotation?

    The leader definitely has xRotation keyframes in it.

    Thank you

    Dan Ebberts
    replied 5 years, 2 months ago
    2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    July 13, 2021 at 2:58 pm

    Try it this way:

    src.transform.xRotation.valueAtTime(time – d);

  • Shaun Thomson

    July 14, 2021 at 2:50 am

    Thank you Dan. It’s throwing a syntax error now. I can’t find anything wrong with the syntax though – is anything obvious sticking out please?

    src=thisComp.layer(“Leader”);

    delay = thisComp.layer(“Leader”).effect(“Delay”)(“Slider”);

    d = delay*thisComp.frameDuration*(index – 1);

    src.transform.xRotation.valueAtTime(time – d);

    Error: missing ) after argument list

  • Dan Ebberts

    July 14, 2021 at 3:31 pm

    Once I fixed the mangled quotes and minus signs (which happens in this forum if you don’t use a preformatted text box to post code), it seems to work fine. This should be OK:

    src=thisComp.layer("Leader");

    delay = thisComp.layer("Leader").effect("Delay")("Slider");

    d = delay*thisComp.frameDuration*(index - 1);

    src.transform.xRotation.valueAtTime(time - d);

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