ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression help needed

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jon Smith
Expression help needed
on Feb 10, 2009 at 6:42:16 pm

Not quite sure how to explain this so I made a diagram.

http://foxbot.tv/temp/expression_diagram.gif

I would like to add an expression to null c so that where ever I move points a and b, c is equal to the distance between a and b and also at the same angle. I can figure it out mathematically but have no idea how to translate it into a working expression. Any help is greatly appreciated.



Return to posts index

Dan Ebberts
Re: Expression help needed
on Feb 10, 2009 at 7:16:36 pm

Try this:

A = thisComp.layer("a");
B = thisComp.layer("b");

a = A.toWorld(A.anchorPoint);
b = B.toWorld(B.anchorPoint);
2*b - a


Dan



Return to posts index

Jon Smith
Re: Expression help needed
on Feb 10, 2009 at 7:22:47 pm

Worked liked a charm. Makes complete sense once you write it out. Thank you so much.



Return to posts index


cowcowcowcow
Jon Smith
Re: Expression help needed
on Feb 13, 2009 at 4:58:26 pm

I now have a new problem. What If I don't want C to equal the distance betweem A and B. I want to be able to move C around but keep it at the correct angle?



Return to posts index

Dan Ebberts
Re: Expression help needed
on Feb 13, 2009 at 5:51:09 pm

One way would be to add a slider to c and change the expression to this:

slider = effect("Slider Control")("Slider");

A = thisComp.layer("a");
B = thisComp.layer("b");

a = A.toWorld(A.anchorPoint);
b = B.toWorld(B.anchorPoint);
b + (b-a)*slider

You might want to adjust the slider range so that it only goes from 0 to 5 instead of 0 to 100.

Dan



Return to posts index

Jon Smith
Re: Expression help needed
on Feb 16, 2009 at 4:26:48 pm

Thanks once again Dan Ebberts!



Return to posts index

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