ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Piston animation

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mark Marino
Piston animation
on Apr 10, 2020 at 1:28:18 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.


Help!

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;


Return to posts index

Mark Marino
Re: Piston animation
on Apr 10, 2020 at 3:17:35 am

FYI - I was able to get things working based on another explanation I found here:
https://graphicdesign.stackexchange.com/questions/98384/create-an-animation...

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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]