Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Using expressions to find Chord of circle

  • Using expressions to find Chord of circle

    Posted by Xander Marritt on October 19, 2010 at 2:57 pm

    Hey,

    im trying to attach an object to the bottom of a swinging sign. The anchor point of the sign is at the top so i can make it swing, which means i cant attach the other object to the anchor point. I figured i could use maths to find out the length of the chord on the circle in which the sign would be swinging and use expressions to make the object position itself accordingly.

    Im working on positioning it on the z axis however it isnt working at all heres the code, is there and easier way or why isnt the maths working properly?

    thanks!

    x = (thisComp.layer("page1").transform.xRotation /360) * (2*Math.PI*720);

    C = (2 * Math.PI * 720);

    A = x / C * 360;

    L = 720 * Math.sin(A/2) * 2;

    thisComp.layer("page1").transform.position + [
    0,
    736,
    L
    ]

    Chris Wright replied 15 years, 11 months ago 3 Members · 2 Replies
  • 2 Replies
  • Kevin Camp

    October 19, 2010 at 4:20 pm

    you might try parenting the object layer to the sign layer, but offset it’s position so that it is at the bottom of the sign. since the position is now relative to the signs, as the sign rotates, the object layer should stay stuck to the bottom.

    you might also check out this tutorial:

    https://library.creativecow.net/articles/armstrong_trent/swinging_chain.php

    it may be useful for what you’re doing.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Chris Wright

    October 19, 2010 at 7:37 pm

    add a slider to the layer to edit rotation.

    name your rectangle “End 2” and paste this in rotation of the sign.

    Now you can use a dummy system so that you can parent objects, always auto orient to the layer being called to.

    follow2 = “End 2”
    diff = sub(position,this_comp.layer(follow2).position);

    (Math.atan2(diff[1],diff[0]) * 180/Math.PI) + 180+effect(“Slider Control”)(“Slider”)

    https://technicolorsoftware.hostzi.com/

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