Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Piston animation

  • Piston animation

  • Mark Marino

    April 10, 2020 at 1:28 am

    Hi all – I need to animate a piston for an engine animation I’m working on and I’m having a hard time getting it working properly… my AE expressions skills are basic and I’ve forgotten trig altogether.

    The only sources I’ve found on this are Dan Ebberts article here on CC from WAY back in 2001, but all the images and links are dead, so it’s hard to follow along. I also found this video which seemed promising, other than the fact that it’s in Korean… I was able to mostly follow it, but my attempt isn’t working. I think it *might* be that in his example, the piston is oriented on the x axis, and in my engine, the piston is oriented on the y axis, but I don’t know how to change the expression to accommodation that. Maybe one of CC’s expression wizards can shed some light on that. The code for the Rotation property on the connecting rod is as below.


    p.s. is there any way at all to check the values of x, y, and v in the expression above? I tried to write them out to sourceText of a text layer, but that doesn’t work.

    c = thisComp.layer("Piston");
    tLayer = c.toWorld(c.anchorPoint);
    cLayer = thisLayer.toWorld(thisLayer.anchorPoint);
    x = tLayer[0] - cLayer[0];
    y = tLayer[1] - cLayer[1];
    v = Math.atan2(y,x);
    radiansToDegrees(v) + 90;

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

  • Mark Marino

    April 10, 2020 at 3:17 am

    FYI – I was able to get things working based on another explanation I found here:

    I’d still like to see Dan’s article restored to it’s former glory as he gives such a good explanation of things.

Viewing 1 - 2 of 2 posts

Log in to reply.

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