Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Objects rotation dictates precomp’s rendered frame?

  • Objects rotation dictates precomp’s rendered frame?

    Posted by Ryan Hauser on July 27, 2016 at 7:10 pm

    I feel like this is going to be really hard to describe.

    Comp A has a 2 second looping animation of a rectangular prism rotating towards the camera.

    Comb B has a rectangle with a Precomp of Comp A parented over it.

    I want the rotation of the rectangle to dictate what frame of Comp A for Precomp A to render at any given time.

    For instance, if the rectangle has a rotation of 0, it will render Precomp A from frame 0 of comp A. If the rectangle is rotated at 180 degrees, it would render the precomp to appear as it does in Comp A at frame 30. Am I making sense? I feel like I’m not making sense. Here’s a picture I drew in 5 minutes.

    Either way, if you can decipher what I’m trying to get across, I’d love to hear your thoughts!

    Ryan Hauser replied 9 years, 9 months ago 2 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    July 27, 2016 at 7:49 pm

    I would think a time remapping expression like this would do it:

    degPerFrame = 6;
    r = thisComp.layer(“rectangle”).transform.rotation;
    frame = r/degPerFrame;
    framesToTime(frame)

    Dan

  • Ryan Hauser

    July 28, 2016 at 3:47 pm

    Awesome, that’s works exactly as I wanted it to! However, I do have a few questions.

    Comp A is only 2 seconds long, making a single full rotation. This means the rectangle in Comp B can only make one full rotation of 360 degrees before the fake 3D stops working. Same thing with rotating counterclockwise; once it goes into negative rotation it will render Precomp A as it appears on frame 0 of Comp A. I suppose I could make Comp A longer and fiddle the expressions a little bit, but I feel like theres probably a way to get it to work indefinitely in its current state, regardless of how many times it has done a full rotation.

    Thanks for all your help so far though, it looks amazing.

  • Ryan Hauser

    July 28, 2016 at 4:21 pm

    (Here’s what it looks like now)

  • Dan Ebberts

    July 28, 2016 at 4:54 pm

    Try changing this line:

    frame = r/degPerFrame;

    to this:

    frame = (r/degPerFrame)%60;

    Dan

  • Ryan Hauser

    July 28, 2016 at 4:58 pm

    Perfect. Works flawlessly! Now if only I knew what any of these things meant rather than simply copy-pasting them, I’d be on fire!

    Thanks again for the help.

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