Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Eccentric (elliptical) orbit around null object?

Guest
Feb 20, 2019 Feb 20, 2019

I have made a planetary orbit animation such as in this video: https://www.youtube.com/watch?v=BJUtbBo-PAw, except mine is top-down view. It is intended to show the orbits of moons in correct time and approximate 2D position.

Essentially two circles, viewed from the top, one paired to a null object that shares the anchor point with the other circle, orbiting using Z rotation.

I need to change the orbit from circular to elliptical, with an eccentricity of 0.75

How would I do this?

I found a recommendation on creativecow  https://forums.creativecow.net/archivethread/2/482236#482525

But I'm not sure where to enter that code, or if that will even work. I think I enter the position expression by alt-clicking something, but I dont know where it goes or how to format it.

I am very new to AE, this is my first project although I have been using PS for a very long time.

Any help greatly appreciated!

977
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Feb 21, 2019 Feb 21, 2019

The code does work - it's from Mr. Dan Ebberts : )

No need to concern yourself with nulls, parenting and rotation in this case - simply create the layer you want to be in orbit, Alt click on the stopwatch for position and paste in that code in the box to the right (overwrite the code that is in there by default).

Change the number on the first line to adjust the orbit frequency, and change w and h in a  1 to 0.75 ratio to get your required eccentricity.

EllipticalOrbitXpression.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 22, 2019 Feb 22, 2019

I got it working. I now realize that the final line is the array that is the position expression. Everything else is just inconsequentially named variables used to populate the final array.

What if I wanted to display the position of the object on screen? Is there a way to link some text on the screen to one of those variables in the position expression?

Precisely, I want to display the distance of the moon from the planet it is orbiting, as well as the time value (taking the values and multiplying them by whatever value is necessary to get them from pixels to astronomical units, and from seconds to days; so I would actually need the displayed text to link to variables, not just the pixel position)

Thank you very much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2019 Feb 23, 2019
LATEST

Personally, I would modify Dan's expression, add some expression sliders, use parenting, attach a bar to the number display to make it easier to visualize, and basically automate the whole thing. I already have and have saved it as an animation preset. The other expressions that I use in this example are also in my library of custom animation presets. It took me less than 3 minutes to create this comp from my animation presets:

Screenshot_2019-02-23 00.36.53_bBHrv5.png

The modified expression for an elliptical orbit:

f = 1 / effect("Speed")("Slider"); // frequency (revolutions per second)

c = [0, 0] //center

w = effect("Major Axix")("Slider"); //major axis

h = w * 100 / effect("Minor Axis  %")("Slider"); //minot axis

ofst = effect("Offset")("Point");

t = time*f*2*Math.PI;

ofst + [Math.cos(t)*w, Math.sin(t)*h]/2 + c

The expression for the counter:

point1 = toWorld(thisComp.layer("Moon").position);

point2 = toWorld(thisComp.layer("Earth").anchorPoint);

d = length(point1, point2);

Math.round(d)

The expression for the bar:

point1 = toWorld(thisComp.layer("Moon").position);

point2 = toWorld(thisComp.layer("Earth").anchorPoint);

y = length(point1, point2);

mf = effect("Multiplier %")("Slider") / 100;

x = value[0];

[x, y * mf]

and finally, the expression for the bar's Transform Rectangle 1>Anchor point:

y = content("Rectangle 1").content("Rectangle Path 1").size[1]/2;

[0, y]

I'll even share my animation presets:

Dropbox - Earth Moon distance bar.ffx

Dropbox - length counter.ffx

Dropbox - Moon Orbit.ffx

All you have to do is create an Earth layer with the anchor point centered on the earth. (shape tool), then with no layer selected run the Moon Orbit preset. This will create a new shape layer. Then Rename the layer Moon, Parent the Moon layer to the Earth, then double click the length counter preset and then the Earth Moon distance bar preset. Adjust the sliders as needed and you're basically done.

Here's AEP file for you:

Dropbox - Moon Orbit CC 14.aep

The sliders make it easy to adjust the ellipse and offset it, Parenting makes it easy to position the earth anywhere you like. I've used these animation presets about a dozen times in the last two years for a client that always wants things spinning around. I hope this helps you polish up your project.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines