Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions accessing sub-composition property

  • accessing sub-composition property

    Posted by Johan Weidlerino on September 24, 2012 at 1:58 pm

    Hi, I have a wheel comp, within a layer “rim”

    Now, the rim, nothing else, shall rotate to the x-position of the wheel.
    So I tried to add the following script to the position-properties of the wheel-layer in wheel’s parent-composition.
    720 is the circumference of the wheel in px.

    var r = (transform.position[0] / 720 * 360)/(180/Math.PI); // rad
    thisComp.layer("wheel").layer("rim").transform.rotation = r; // I guess I can't stack layer-properties? but what then?
    value + [0,0]; // If I dont do this, it causes a dimension-exception

    I haven’t figured out yet if the math is correct or if I need rotation or radiants. So far I just can’t get access to the rim-layer in the wheel-composition.

    How can I do that?

    Thank you, guys.

    Dan Ebberts replied 13 years, 10 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    September 24, 2012 at 3:18 pm

    It looks like you’re trying to control rotation from a position expression. If so, that won’t work–the expression needs to be on the rotation property itself (an expression can only affect its host property, nothing else).

    So your calculation would be something like:

    360*(wheel’s x distance)/(wheel’s circumference)

    where:

    (wheel’s circumference) = (wheel’s diameter)*Math.PI

    Dan

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