Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Train Trigonometry

  • Dan Ebberts

    December 19, 2012 at 3:33 am

    Assuming that the rotating piece on the right is the parent of the other rod, which is the parent of the piston, I’d use something like this for the rod’s rotation:

    a = parent.transform.rotation;
    r1 = 100;
    r2 = 200;
    b = radiansToDegrees(Math.asin(Math.sin(degreesToRadians(a))*r1/r2));
    -(a+b)

    and something like this for the piston’s rotation:

    a = parent.parent.transform.rotation;
    r1 = 100;
    r2 = 200;
    radiansToDegrees(Math.asin(Math.sin(degreesToRadians(a))*r1/r2));

    r1 is the length of the rotating rod and r2 is the length of the other rod.

    Dan

    [edit: oops–added missing last line of first expression]

  • Davis Lindsay

    December 19, 2012 at 5:13 pm

    That works nicely Dan, thanks.

    Each time I get a response form you I learn something new.
    The parent trick is epic for this.

    Prepare for today and you’ll survive, prepare for tomorrow and you will thrive.

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