FORUMS: list search recent posts

# HowTo: Expression Angle Control dictates the Position of a Null

FAQ   •   VIEW ALL
 HowTo: Expression Angle Control dictates the Position of a Null on Oct 11, 2013 at 3:21:43 am

As the Subject Title says BUT with an additional requirement - the Null can only move along the perimeter/edge of the Comp.

Cheers
RoRK

Intensive mocha & AE Training in Singapore and Other Dangerous Locations

Imagineer Systems (mocha) Certified Instructor
& Adobe After Effects CS6 ACE/ACI

 Re: HowTo: Expression Angle Control dictates the Position of a Nullon Oct 12, 2013 at 11:11:50 pm

This is probably too late to help, but I finally found enough time to work this one out.

``` a = effect("Angle Control")("Angle")%360; if (a < 0) a += 360; ar = degreesToRadians(a); w = thisComp.width; h = thisComp.height; g = Math.atan2(h,w); if ((ar > Math.PI*2 - g) || (ar <= g)){ x = w; y = (h + w*Math.tan(ar))/2 }else if ((ar > g) && (ar <= Math.PI - g)){ x = (w - h*Math.tan(ar - Math.PI/2))/2; y = h; }else if ((ar > Math.PI - g) && (ar <= Math.PI + g)){ x = 0; y = (h - w*Math.tan(ar - Math.PI))/2; }else{ x = (w + h*Math.tan(ar - 3*Math.PI/2))/2; y = 0; } [x,y] ```

Dan

 Re: HowTo: Expression Angle Control dictates the Position of a Nullon Oct 14, 2013 at 2:56:42 am

Thanks Dan! This worked wonderfully!

Cheers
RoRK

Intensive mocha & AE Training in Singapore and Other Dangerous Locations

Imagineer Systems (mocha) Certified Instructor
& Adobe After Effects CS6 ACE/ACI

 Re: HowTo: Expression Angle Control dictates the Position of a Nullon Nov 25, 2013 at 10:06:21 am

Hi Dan,

Just found this thread. This is something i wanted to do long time ago. havent found the trick. :P

I have situation here:
I found this code: that calculate degrees from position.velocity. I use linear to animate position. how can i merge this code to make animated current position to angle control? something like direction.

Thanks
```v = position - position.valueAtTime(time-thisComp.frameDuration); radiansToDegrees(Math.atan2(v[1],v[0]))```