Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Follow effect using position.valueatTime() of parented layer?

  • Follow effect using position.valueatTime() of parented layer?

    Posted by Cameron Foxly on August 15, 2024 at 9:52 pm

    I have three layers: Null_1, Null_2, and Null_3. Null_1 is parented to Null_2, and Null_3 is referencing the world position of Null1 with an expression on it’s position value.

    I have used this expression for years to grab the world position of Null_1, to use as Null_3’s position value:

    L = thisComp.layer("Null_1");
    L.toWorld(L.anchorPoint)

    However, I’d like to delay position value of Null_3 by a few frames, so it follows Null_1, instead of being stuck to it exactly. Usually, I’d run a Null_1.transform.position.valueatTime(time-delay) to create a follow effect, but with the above expression, I’m referencing the anchor point, which doesn’t change over time…

    Is there a way to have the return of the above expression be delayed by a set time?

     

    Brie Clayton
    replied 3 weeks, 2 days ago
    3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    August 15, 2024 at 10:06 pm

    toWorld() has a built-in time parameter. Try it this way:

    delay = 3; // delay frames
    L = thisComp.layer("Null_1");
    L.toWorld(L.anchorPoint,time - delay*thisComp.frameDuration)
  • Cameron Foxly

    August 15, 2024 at 11:28 pm

    What a pleasant surprise to get a Dan Ebberts reply! I think I learned the original expression from an old comment of yours years ago, so how fitting to close the loop the same way. Thank you for all your help over the years!

    I had been looking through the reference for valueatTime() and didn’t think to check the toWorld() docs, so didn’t consider it would have a time parameter. D’oh!

    This solved it, thanks!

    (Hi, me, in 5 years when I forget this and google it, and find this post)

  • Brie Clayton

    August 16, 2024 at 3:09 pm

    Thanks for this solve, Dan!

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