Circle Script easy for anything!

Scripting for After Effects

Circle Script easy for anything!

Postby alenko on 10/18/2016, 7:15 am

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)+xCenter
r*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:

Image
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!

Postby Gerry Clark on 10/20/2016, 1:08 am

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: 147
Joined: 07/3/2009, 6:31 am

Re: Circle Script easy for anything!

Postby alenko on 10/23/2016, 10:34 am

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!

Postby hans123 on 10/23/2016, 1:21 pm

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: 1096
Joined: 12/28/2012, 1:37 am
Location: Paris / France

Re: Circle Script easy for anything!

Postby alenko on 10/24/2016, 3:25 am

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