Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Trying to make one shape rotate with a 5 seconds delay behind another shape

  • Trying to make one shape rotate with a 5 seconds delay behind another shape

    Posted by jess Mah on January 31, 2025 at 9:35 pm

    Hey all, I am new to ae expressions and by no mean a math genius. I thought this expression will drive the lower layer to rotate 5 seconds behind the top layer but they are rotating in sync. the expression seems valid with no error. What did I miss here?

    Top layer (index 2):

    var initialRotation = 0;

    var rotationIncrement = 10;

    var currentRotation = initialRotation + rotationIncrement + Math.floor(time);

    [currentRotation]

    Bottom layer (index 3) :

    var R = thisComp.layer(index-1).transform.rotation;

    var P = R.valueAtTime(time-5);

    [P]

    https://youtu.be/3EoU6TzPLM0

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

    Brie Clayton replied 1 year, 2 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    February 2, 2025 at 7:39 am

    If you look at the rotation values in the graph editor, you’ll see that the lower layer is actually 5 seconds behind the upper layer.

    Just a couple of notes on your expressions. You don’t need the final variable, and you don’t need to put the result in brackets (because rotation is a one-dimensional property), so this would do for the top expression:

    initialRotation = 0;
    rotationIncrement = 10;
    initialRotation + rotationIncrement + Math.floor(time)

    and this for lower one:

    R = thisComp.layer(index-1).transform.rotation;
    R.valueAtTime(time-5);

    Also, I’m wondering if the upper rotation is actually what you meant to do or whether you needed a multiplication, like this:

    initialRotation = 0;
    rotationIncrement = 10;
    initialRotation + rotationIncrement * Math.floor(time)
  • jess Mah

    February 21, 2025 at 5:00 pm

    Thank you !!! The top one works like I intended – its a very elegant solution! 😀

  • Brie Clayton

    February 22, 2025 at 3:13 pm

    Thank you for this solve, Dan!

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