After Effects - Abstract Space Scene

Full Tutorial:

Code for the Moon's rotation:

let mainPoint = thisComp.layer("SUN").transform.position;
let lastPoint = position;

let distanceX = mainPoint[0] - lastPoint[0];
let distanceY = mainPoint[1] - lastPoint[1];

let myAngle = Math.atan2(distanceY, distanceX);

radiansToDegrees(myAngle);

Last updated