## Circle Script easy for anything!

Scripting for After Effects

### Circle Script easy for anything!

So i needed light to rotate around object, i always ended up with messed rotation.

So i decided to use my old school Math code from programming

If you have any other idea hit me. i tried alot and this did work best for me.
To rotate in circle and everything else is fixed!

Code: Select all
`r*Math.cos(time)+xCenterr*Math.sin(time)+yCenter`

So you put this into Expression like above.
If you have 3d space and you need light to rotate above and around object you use Z and X
explanation
remember you need to first Separate Dimensions

r= Radius (how far from center does it rotate)
xCenter and yCenter are your values where is positioned example in 2d model 1080p would be x=960 and y=540 rotate around center
time you can leave or multiply or divide
Or you can make 3dimensional rotate sphere like!:)

Quick Example:

alenko

Posts: 17
Joined: 09/16/2016, 3:51 am
System Specs: AMD FX 8350 5ghz watercooled, radeon r9 290, 16gb ram 1866mhz

### Re: Circle Script easy for anything!

If I need an object to orbit around a point I usually put a null at that point, parent it to my object then rotate the null.
Gerry Clark

Posts: 148
Joined: 07/3/2009, 6:31 am

### Re: Circle Script easy for anything!

yeah i did that to, but i used it different way i coudnt achive my effect
alenko

Posts: 17
Joined: 09/16/2016, 3:51 am
System Specs: AMD FX 8350 5ghz watercooled, radeon r9 290, 16gb ram 1866mhz

### Re: Circle Script easy for anything!

Hello alenko,

Scenario:
You have a object and you would like the light orbit around the object,
try this:
- create a Null-Object (Layer 3D) in the Center of your object
- create a Light in the Center of your object
- parent the Light to the Null object
- use "Anchor-Point" of the Null-Object to position the Light in the "Orbit"
(example: modify Anchor-Point X value to bring the light in the right position)
- use >>Null-Object >>Rotation
(example: rotate around the Y-Axis)

Hans

Hans
hans123

Posts: 1145
Joined: 12/28/2012, 1:37 am
Location: Paris / France

### Re: Circle Script easy for anything!

Yes this is only for circle rotate,
but i made more complex stuff that i coudnt achive with this.
so i use trigonometric functions for some stuff
alenko

Posts: 17
Joined: 09/16/2016, 3:51 am
System Specs: AMD FX 8350 5ghz watercooled, radeon r9 290, 16gb ram 1866mhz

Return to After Effects Expressions