Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Arrow always pointing to centre.

  • Arrow always pointing to centre.

    Posted by Henry Gaunt on June 18, 2009 at 12:38 pm

    Hello,

    Please hang with me here for a minute.

    Imagine your looking top down at a 20 cent coin. Then imagine another 20 cent coin is circling that 1st coin. Like the moon around the Earth – but all in flat 2D.

    What I would like is this, an arrow to point from the outer coin, to the centre coin as it rotates around.

    How do I make the arrow tip always face the centre of the centre coin, and the other end to rotate correctly as the outer coin as it circles around.

    Do I make sense?

    Is there an expression that can help?

    Thank you.

    Dan Ebberts replied 16 years, 11 months ago 5 Members · 11 Replies
  • 11 Replies
  • Michael Szalapski

    June 18, 2009 at 2:42 pm

    You could just put a null object at the centre, put the arrow pointing to the coin then parent the arrow and coin to the null. Then when you rotate the null, the coin and arrow will spin around it with the arrow always facing it.

    – The Great Szalam
    (The ‘Great’ stands for ‘Not So Great, in fact, Extremely Humble’)

    No trees were harmed in the creation of this message, but several thousand electrons were mildly inconvenienced.

  • Dan Ebberts

    June 18, 2009 at 2:44 pm

    An expression like this for rotation should do it:

    offset = 180;
    L = thisComp.layer(“sun”);
    P1 = L.toWorld(L.anchorPoint);
    P2 = toWorld(anchorPoint);
    delta = P2 – P1;
    offset + radiansToDegrees(Math.atan2(delta[1],delta[0]))

    Adjust “offset” until the layer is pointing where you want (probably 0, 90, 180 or -90.

    Dan

  • Michael Szalapski

    June 18, 2009 at 2:52 pm

    Hooray for Dan (yet again)! He’s like a superhero; wherever there is (expression) trouble, he is there.

    – The Great Szalam
    (The ‘Great’ stands for ‘Not So Great, in fact, Extremely Humble’)

    No trees were harmed in the creation of this message, but several thousand electrons were mildly inconvenienced.

  • Kevin Camp

    June 18, 2009 at 2:56 pm

    to give you the best answer, it would help to know how you have your orbiting coin moving in a circle. did you use an expression, copy/paste a circular path into the position property, patent to a rotating null in the center of the other coin, etc…?

    an easy way to get the arrow to always point towards it’s point of rotation, is to create a null, animate it’s rotation, then parent the arrow to it and position the arrow some distance from the null, but so it still points at the null. then ast the null rotates, the arrow will always be pointing inward.

    if the arrow is following a circular path (either one copy/pasted from a mask path, or created some other way) you should be able to use layer>transform>auto-orient to have the arrow orient along the path. you can use the rotation property to adjust the orientation if needed.

    do either of these help?

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Kevin Camp

    June 18, 2009 at 2:57 pm

    boy, i really need to work on my typing speed…

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Dan Ebberts

    June 18, 2009 at 4:36 pm

    This is a slightly better version. You can adjust it simply by click+dragging the rotation value.

    L = thisComp.layer(“sun”);
    P1 = L.toWorld(L.anchorPoint);
    P2 = toWorld(anchorPoint);
    delta = P2 – P1;
    value+radiansToDegrees(Math.atan2(delta[1],delta[0]))

    Dan

  • Ken Knowles

    June 18, 2009 at 7:19 pm

    Dan,

    Why would you use an expression instead of a null object in this case? Am I missing something?

    Ken Knowles
    Knowles-McNiff

  • Kevin Camp

    June 18, 2009 at 7:37 pm

    i think if the arrow was parented to the orbiting coin, the expression would make things easier. that way if the coin animation changed it would be reflected in the arrow automatically….

    but you could easily achieve this with a null and parenting too.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Ken Knowles

    June 18, 2009 at 9:49 pm

    I must be doing something wrong. I put the expression in the rotation of the arrow, parented the arrow to the earth, and parented the earth to the sun. When I rotate the sun, the arrow doesn’t always point at the sun.

    Ken Knowles
    Knowles-McNiff

  • Henry Gaunt

    June 19, 2009 at 12:19 am

    Right, I feel like an idiot!

    So simple, null, centre, rotate. Why do I always think it’s going to be more complicated!

    Thank you Michael and others!

Page 1 of 2

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