ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Parenting an Angle control to 3D layer position

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jonny Law
Parenting an Angle control to 3D layer position
on Oct 26, 2018 at 5:14:03 am

As the Subject states,

I'm attempting to parent a 2D effect that uses an Angle control (e.g. Bevel Alpha, Drop Shadow) to a 3D light's position.

Is there an expression setup that will allow me to dynamically affect the results even when the 3D light's position moves around the comp?


Return to posts index

Kalleheikki Kannisto
Re: Parenting an Angle control to 3D layer position
on Oct 30, 2018 at 5:41:47 pm

I can't do it off the top of my head, but the idea is to get the 2D position of the 3D layer, and the reference position of the layer with the effect on it (likely to be the anchor point), then calculate the angle between the two points. You can find the expressions for both of these -- at least separately -- in this forum, and just need to combine them.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Filip Vandueren
Re: Parenting an Angle control to 3D layer position
on Oct 30, 2018 at 10:59:22 pm

This seems to work, though I haven't tested it rigorously

l=thisComp.layer("Point Light 1");
pos = fromCompToSurface(l.toComp([0,0]));
ang = Math.atan2(pos[1],pos[0]);

-radiansToDegrees(ang);




Return to posts index


Jonny Law
Re: Parenting an Angle control to 3D layer position
on Nov 1, 2018 at 3:52:29 am

This works with pretty darn close accuracy!

Personally I've never used the fromCompToSurface expression before, but I'll keep this little gem in mind next time.

Thanks, Filip & Kalleheikki!


Return to posts index

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