Answers.Body: <p>Ok, it's relatively straightforward using some expressions. But then again isn't everything?</p>
  
  <p>Assuming you've got your original rotating beam layer, your epicycle layer which is parented to the original beam, and your Venus layer parented to that. You need to find the co-ordinates of the center of the Venus layer, relative to the Composition, in order to draw a beam to it. </p>
  
  <p>Well you could work it out trigonometrically I'm sure, but it's way too late and I've been into the Irish Single Malt, so I'm not going to go there. Luckily there's a handy expression that does the job: <code>toComp(point)</code>. What it does is find the composition co-ordinates of a point on a layer. </p>
  
  <p>First we apply a <strong>Point Control</strong> effect <em>Effects>Expression Controls>Point Control</em> to the Venus layer, we'll use the <code>toComp</code> expression to set its value. But before that, make sure the <strong>Anchor Point</strong> property of the Venus layer is showing – we'll need it in a second. </p>
  
  <p>Now to apply an expression to the point control <kbd>alt/opt</kbd>-click the stopwatch on the <strong>Point</strong> property of that effect. In the expressions editor that opens up type <code>toComp(</code> and then drag the expression pick-whip to the <strong>Anchor Point</strong> property to fill in the value <code>Transfrom.AnchorPoint</code>. You can type it, but it's case sensitive and not at all forgiving of typos. Then close the brackets: <code>)</code> it should now read <code>toComp(transform.anchorPoint)</code>.</p>
  
  <p><img src="https://i.sstatic.net/KNJV8.png" alt="enter image description here"></p>
  
  <p>So now you have a point that tells you where exactly the Venus Layer's anchor point is in the comp. Using an expression you could plug this straight into the <strong>End Point</strong> property of the <strong>Beam</strong> effect, but I'm allergic to the beam effect, I prefer to use shape layers, because vectors.</p>
  
  <p>So I make a new rectangular shape layer with the stroke I want, and no fill, and I set all the transforms to 0. The size of the rectangle path is going to be the length between the start of the original beam, and the value of the <strong>Point Control</strong> point, AKA the position of Venus. You can do this by getting the square root of the sum of the squares of the X and Y offsets, but that's a bit 6th century BC, instead we'll use the handy expression <code>length(point1, point2)</code>. And we'll set the height to 0, so that it draws a line.</p>
  
  <p>So on the rectangle shape layer, in the <strong>Contents>Rectangle 1>Rectangle Path 1</strong> Property we'll use this expression:</p>
  
  <pre><code>origin=thisComp.layer("origin");
  venus=thisComp.layer("venus")
  beamlength=length(origin.transform.position, venus.effect("Point Control")("Point"));
  [beamlength,0]
  </code></pre>
  
  <p>layer <em>origin</em> is the original beam. You could do it all on one line, but it would be hella ugly:</p>
  
  <pre><code>[length(thisComp.layer("origin").transform.position,thisComp.layer("venus").effect("Point Control")("Point")),0]
  </code></pre>
  
  <p>Beauty is truth. </p>
  
  <p><img src="https://i.sstatic.net/hEReD.png" alt="enter image description here"></p>
  
  <p>Since by default the rectangle tool draws rectangles around a central point we need to offset it. In the <strong>Contents>Rectangle 1>Rectangle Path 1>Position</strong> Property (not the layer's position property, that should be the same as the original beam, or the shape's <strong>Contents>Rectangle 1>Transform: Rectangle 1>position</strong> property, that should be 0,0) we offset it by half the width, so that the rectangle's left edge is always at the origin, thus : <code>content("Rectangle 1").content("Rectangle Path 1").size/2</code> (did you notice that we're dividing a vector by a scalar? 100 Nerd points to you if you did.)</p>
  
  <p>Now we've got a beam that is the right length, but we need to rotate it. Thank you and good night Pythagoras, hello Mr Aryabhata. Since we know the rise and the run, we can find the angle using Atan(rise/run). But there's some problems: when the run is negative Atan will return a positive value, and whenever the run is 0 the expression will crash. And lastly <code>Math.atan</code> returns a result in Radians, so we need to convert it to degrees. So we have to turn a relatively simple expression into this monster, which goes on the <strong>Contents>Rectangle 1>Transform: Rectangle 1>Rotation</strong> Property:</p>
  
  <pre><code>s=thisComp.layer("venus").effect("Point Control")("Point");
  o=thisComp.layer("origin").transform.position;
  run=s[0]-o[0];
  rise=s[1]-o[1];   
  if (run==0){
   if (rise&gt;0) //pointing straight up
    {-90;}
   else //pointing straight down
    {90;}
  } else{
   if (run&gt;0){
      radiansToDegrees(Math.atan(rise/run));
    } else {
      180+radiansToDegrees(Math.atan(rise/run));
    }
  }
  </code></pre>
  
  <p>this is how my beam layer looks:
  <img src="https://i.sstatic.net/SiWGv.png" alt="enter image description here"></p>
  
  <p>and below is the whole comp. I've used shape layers for everything and driven them all by expressions as is my wont, if you want to have a look at it, it's <a href="http://adobe.ly/1xy8D30" rel="nofollow noreferrer">here</a>.</p>
  
  <p><img src="https://i.sstatic.net/MWjw8.png" alt="enter image description here"></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-07T13:42:09.730Z
Answers.Text: Stack Exchange suggest I shouldn't say thanks here, but I want to thank you very much for your thorough explanations and I hope you'll see my reply. I have already found a solution for my question thanks to the help of the other responders, but I have bookmarked your post and I will surely use it next time. Thank you very much once again for taking the time to this, I'm very impressed. You can take a look at what I've done [here](https://www.behance.net/gallery/17149469/After-Effects).
Answers.UserDisplayName: Paul Lupascu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-21T15:08:59.283Z
Answers.LastActivityDate: 2015-01-21T15:08:59.283Z
Answers.UserDisplayName: stib
Answers.Body: <p>I would probably start from the smallest orbit and work my way out.  If you adjust the anchor point for each object that is rotating, a simple rotation keyframe should make it rotate around the center.</p>
  
  <p>Once you have the smallest thing rotating, you include that composition in another composition and adjust the anchor point similarly to make it rotate around the center of the new composition.</p>
  
  <p>If you need oblong orbits, you can also use a path instead and animate it along the path.</p>
  
  <p>You can keep nesting them indefinitely for as many nestings as you need. It isn't a 100% accurate simulation since the actual orbital mechanics are a bit more complicated, but it gives a simple simulation of them and can easily support various periods for each part.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-14T10:30:13.017Z
Answers.Text: Thanks a lot AJ! I will try this tonite, I'm sure it will be helpful.
Answers.UserDisplayName: Paul Lupascu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-18T21:27:44.347Z
Answers.Text: Thanks again AJ. I can use this trick to create a composition where the beam is static, and then rotate the composition; so I don't need to have the position of the ellipse Venus.
Answers.UserDisplayName: Paul Lupascu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-13T14:00:37.797Z
Answers.LastActivityDate: 2014-05-13T14:00:37.797Z
Answers.UserDisplayName: AJ Henderson
Answers.Body: <p>You probably want to work with Motion Paths here.
  Though for those to work you need beziere based shapes and not parametric shapes like you have right now. The differences is that parametric shapes (coming from the shape tool (rectangle, ellipse etc.)) are defined by numeric parameters (the part with the first position value in your image). Bezier shapes have points with handles to define the shape, what you get when you draw with the pen tool.</p>
  
  <p>You can use the shape tool to make bezier based shapes and I would recommend that you redo the few shapes you have and simply copy over the settings and keyframes from you existing shapes.
  To make a bezier shape with the shape tool simply hold down the <code>alt</code> key while creating the shape.
  Then simply click on the "Path" object in the "Path x" dropdown of your shape.
  <img src="https://i.sstatic.net/0joG4.png" alt="enter image description here"></p>
  
  <p>Then copy that with Ctrl+C and paste it onto the position of your Venus shape. Either the layers position (the one on the bottom of your screenshot) or the position of the shape itself (the middle one in your screenshot). That will create keyframes for the current outer path of your shape. Then parent the Venus shape to the epicycle shape and the Venus will rotate along the epicycle and move with it. If the Venus is a bit off you can offset the position with either the layer position or the shape position depending on which one you chose to paste the motion path on.
  This will result in an animation like this:
  <img src="https://i.sstatic.net/wgK7k.gif" alt="enter image description here">
  <img src="https://i.sstatic.net/rM4g3.png" alt="enter image description here"></p>
  
  <p>I hope thats what you were after.
  If you want to extend the length of the motion path animation just select all the keyframes and drag the last one with the alt key pressed.</p>
  
  <p>To make a connection between Venus and the Epicycle center you have to work with an expression. The easiest way would be to create a null that you parent to Venus and then move the Nulls Anchor Point to the center of the Venus (work from the start frame of the animation to make your life easier). Then apply this expression to one end of the beam effect: </p>
  
  <pre><code>L = thisComp.layer("Null 1");
  L.toWorld(L.anchorPoint)
  </code></pre>
  
  <p>"Null 1" being the name of you Null object. This expression gives you the actual global position of your null. If you just use the position value it wont move as these values aren't actually animated right now. We basically get what After Effects is doing in the background to the objects position when parenting an object to an animated layer.</p>
  
  <p>Then simply parent the position of the other end of the beam effect to the position of Epicycle (given that the Epicycle has its Anchor Point centered).</p>
  
  <p>Here is an After Effects example project to understand it more easily.</p>
  
  <p>CS6: <a href="http://www1.zippyshare.com/v/84425880/file.html" rel="nofollow noreferrer">http://www1.zippyshare.com/v/84425880/file.html</a></p>
  
  <p>CS5.5: <a href="http://www19.zippyshare.com/v/13633271/file.html" rel="nofollow noreferrer">http://www19.zippyshare.com/v/13633271/file.html</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-14T10:30:54.697Z
Answers.Text: Hey, I really appreciate the detailed reply, thank you very much. I'll try this tonight and let you know!
Answers.UserDisplayName: Paul Lupascu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-14T19:59:23.553Z
Answers.Text: Just ask if you have further questions.
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-18T21:01:01.877Z
Answers.Text: Hello Proffesor FartSparkle! Thanks again for your reply, I used your instructions and you can indeed get a shape to rotate on a circle which is rotating on a circle this way. However, as I see now, there's no way to describe such a path for a shape while using a single position parameter (or how it's called). Our shape will rotate on the circle, and the circle will rotate on another circle, so it's total movement is described by two different layers. If you want to add a beam between the center of the epicycle and Venus, the starting or ending point will only follow one of the two movements.
Answers.UserDisplayName: Paul Lupascu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-18T21:05:03.750Z
Answers.Text: You can see this illustrated [here](http://s1.postimg.org/khgq0fi3z/ae1.gif)
Answers.UserDisplayName: Paul Lupascu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-18T22:42:47.220Z
Answers.Text: If you look at the movement of the beams end on the left (the "crosshair" not the visual end of the beam) you see that its going along the epicycle shape but with an offset. I would try to just offset the keyframe animation until it matches the actual position of the epicycle.
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-18T22:48:37.350Z
Answers.Text: Though to make it even easier, just parent that end to the position of the Venus and move the Anchor Point of Venus Shape layer to the center of the shape with the "Pan Behind" tool (right to the camera tool).
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-18T23:20:01.857Z
Answers.Text: Ooh wait, I misunderstood the issue a bit. Let me update the answer with an example project. You have to use an expression here.
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-25T12:30:54.237Z
Answers.Text: Hello Professor FartSparkle! Thank you very much, it would've been a lot harder without your help, hats off to you! I finished it, you can view it here: https://www.behance.net/gallery/17149469/After-Effects?share=1#_=_
Answers.UserDisplayName: Paul Lupascu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-25T12:34:20.790Z
Answers.Text: That expression does the job indeed, but I didn't need it for the beam. The small beams, from C to Venus and from C to Mars are static, while the epicycles are moving, so it wasn't needed. However! I used your expression for the text "Venus" which is following the point Venus. Previously, I parented it to the point Venus and then I had to manually set keyframes so that the text stays upright. Your expression made this automatic, which is much more fluid and nice! Thank you very much again! Although it's weird that I could not do the same for the "Mars" text, but it's not a big problem.
Answers.UserDisplayName: Paul Lupascu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-25T18:58:40.390Z
Answers.Text: You will probably have to alter the expression a bit for another object
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-25T18:59:44.807Z
Answers.Text: Nice animation you made there!
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-13T20:12:18.743Z
Answers.LastActivityDate: 2014-05-18T23:33:47.853Z
Answers.LastEditDate: 2014-05-18T23:33:47.853Z
Answers.UserDisplayName: timonsku
Body: <p>I'm new to After Effects and I might be asking about obvious stuff, but I searched this site and elsewhere and can't find an answer. </p>
  
  <p>Basically I want to orbit some points in a setup similar to the Sun - Earth - Moon (Sun is static, Earth goes around the Sun, and the Moon goes around the Earth), and I need each moving point to have its position change over time so that I can parent other stuff to them.  </p>
  
  <p>I'm trying to animate this graphic:</p>
  
  <p><img src="https://i.sstatic.net/0QPsW.jpg" alt="enter image description here"></p>
  
  <p>I've got the epicycle (the small circle) to rotate around point T (Terre), while V (Venus) is rotating on the epicycle. I have a beam between T and the center of the epicycle (C), but I would also need to add a beam between C and Venus. </p>
  
  <p>I can get Venus to rotate on the epicycle either by making it an ellipse on it's own layer and then parenting it to the epicycle; or I can add it as another ellipse on the same shape layer as the epicycle, making V rotate with the epicycle. But in both cases the position of Venus remains invariable, so the beam can't follow.</p>
  
  <p>How do I make point V rotate on the epicycle such that its own position changes over time allowing me to add a beam between it and the center of the epicycle?</p>
  
  <p>I'm confused by all the different Position parameters, if I create V as an ellipse on its own shape layer there'll be 3 different position parameters and none if them will change over time if V is parented to the epicycle. I've also tried alt-pick-whipping these 3 to the position of the epicycle with no luck. </p>
  
  <p><img src="https://i.sstatic.net/OjvYK.png" alt="enter image description here"></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-05-12T23:09:29.523Z
Comments.Text: Are all your elements based on shape layers or do you use masks aswell?
  Specifically the epicycle, did you draw that or is it from the ellipse tool?
Comments.UserDisplayName: timonsku
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-05-12T23:34:14.603Z
Comments.Text: Hey, thanks for replying! All my elements are based on shape layers. However, I also tried making a solid (opacity 0) and then added a circular mask on it with the size of the epicycle (which is a shape layer). Then I parented this solid to the epicycle, so it would follow its position. Then I tried to copy the "mask path" keyframe from this solid to Venus - hoping that it would thus rotate according to the circular mask and also follow the epicycle that's rotating around T. But it doesn't work, everything goes nuts when I try this.
Comments.UserDisplayName: Paul Lupascu
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-05-12T23:40:40.160Z
Comments.Text: I'm sure I can help you with that, paths in After Effects can be a bit tedious sometimes.
  Though the answer would take some time to write and its long past midnight here. I will write something up for you tomorrow if someone else hasn't already helped you.
Comments.UserDisplayName: timonsku
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-05-13T02:15:14.003Z
Comments.Text: Are you worried about the impact of the position in the orbit on the center of gravity of the objects going around the center?  If not, simple nested compositions could probably do it pretty easily.
Comments.UserDisplayName: AJ Henderson
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-05-13T12:54:13.923Z
Comments.Text: Hi AJ, thanks for replying. I don't need to take into account the center of gravity, so I will try this. As I understand, you're suggesting that I create each movement in a separate composition? So I'll have one comp with Venus rotating on the epicycle, and then another comp with the epicycle rotating on its own orbit around T? Is that what you're recommending? Thanks!
Comments.UserDisplayName: Paul Lupascu
Tags: <after-effects>
Title: Orbits in After Effects
UserDisplayName: Paul Lupascu
ThreadText: # Orbits in After Effects
  
  (Asked by: username_0 on 2014-05-12)
  
  I'm new to After Effects and I might be asking about obvious stuff, but I searched this site and elsewhere and can't find an answer.
  
  Basically I want to orbit some points in a setup similar to the Sun - Earth - Moon (Sun is static, Earth goes around the Sun, and the Moon goes around the Earth), and I need each moving point to have its position change over time so that I can parent other stuff to them.
  
  I'm trying to animate this graphic:
  
  ![enter image description here](https://i.sstatic.net/0QPsW.jpg)
  
  I've got the epicycle (the small circle) to rotate around point T (Terre), while V (Venus) is rotating on the epicycle. I have a beam between T and the center of the epicycle (C), but I would also need to add a beam between C and Venus.
  
  I can get Venus to rotate on the epicycle either by making it an ellipse on it's own layer and then parenting it to the epicycle; or I can add it as another ellipse on the same shape layer as the epicycle, making V rotate with the epicycle. But in both cases the position of Venus remains invariable, so the beam can't follow.
  
  How do I make point V rotate on the epicycle such that its own position changes over time allowing me to add a beam between it and the center of the epicycle?
  
  I'm confused by all the different Position parameters, if I create V as an ellipse on its own shape layer there'll be 3 different position parameters and none if them will change over time if V is parented to the epicycle. I've also tried alt-pick-whipping these 3 to the position of the epicycle with no luck.
  
  ![enter image description here](https://i.sstatic.net/OjvYK.png)
  
  **Tags:** after-effects
  
  > **Comments:**
  > **username_1**: Are all your elements based on shape layers or do you use masks aswell? Specifically the epicycle, did you draw that or is it from the ellipse tool?  
  > **username_0**: Hey, thanks for replying! All my elements are based on shape layers. However, I also tried making a solid (opacity 0) and then added a circular mask on it with the size of the epicycle (which is a shape layer). Then I parented this solid to the epicycle, so it would follow its position. Then I tried to copy the "mask path" keyframe from this solid to Venus - hoping that it would thus rotate according to the circular mask and also follow the epicycle that's rotating around T. But it doesn't work, everything goes nuts when I try this.  
  > **username_1**: I'm sure I can help you with that, paths in After Effects can be a bit tedious sometimes. Though the answer would take some time to write and its long past midnight here. I will write something up for you tomorrow if someone else hasn't already helped you.  
  > **username_2**: Are you worried about the impact of the position in the orbit on the center of gravity of the objects going around the center?  If not, simple nested compositions could probably do it pretty easily.  
  > **username_0**: Hi AJ, thanks for replying. I don't need to take into account the center of gravity, so I will try this. As I understand, you're suggesting that I create each movement in a separate composition? So I'll have one comp with Venus rotating on the epicycle, and then another comp with the epicycle rotating on its own orbit around T? Is that what you're recommending? Thanks!  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2015-01-21. Score: 2 | Accepted answer
  
  Ok, it's relatively straightforward using some expressions. But then again isn't everything?
  
  Assuming you've got your original rotating beam layer, your epicycle layer which is parented to the original beam, and your Venus layer parented to that. You need to find the co-ordinates of the center of the Venus layer, relative to the Composition, in order to draw a beam to it.
  
  Well you could work it out trigonometrically I'm sure, but it's way too late and I've been into the Irish Single Malt, so I'm not going to go there. Luckily there's a handy expression that does the job: `toComp(point)`. What it does is find the composition co-ordinates of a point on a layer.
  
  First we apply a **Point Control** effect *Effects>Expression Controls>Point Control* to the Venus layer, we'll use the `toComp` expression to set its value. But before that, make sure the **Anchor Point** property of the Venus layer is showing – we'll need it in a second.
  
  Now to apply an expression to the point control `alt/opt`-click the stopwatch on the **Point** property of that effect. In the expressions editor that opens up type `toComp(` and then drag the expression pick-whip to the **Anchor Point** property to fill in the value `Transfrom.AnchorPoint`. You can type it, but it's case sensitive and not at all forgiving of typos. Then close the brackets: `)` it should now read `toComp(transform.anchorPoint)`.
  
  ![enter image description here](https://i.sstatic.net/KNJV8.png)
  
  So now you have a point that tells you where exactly the Venus Layer's anchor point is in the comp. Using an expression you could plug this straight into the **End Point** property of the **Beam** effect, but I'm allergic to the beam effect, I prefer to use shape layers, because vectors.
  
  So I make a new rectangular shape layer with the stroke I want, and no fill, and I set all the transforms to 0. The size of the rectangle path is going to be the length between the start of the original beam, and the value of the **Point Control** point, AKA the position of Venus. You can do this by getting the square root of the sum of the squares of the X and Y offsets, but that's a bit 6th century BC, instead we'll use the handy expression `length(point1, point2)`. And we'll set the height to 0, so that it draws a line.
  
  So on the rectangle shape layer, in the **Contents>Rectangle 1>Rectangle Path 1** Property we'll use this expression:
  
  ```
  origin=thisComp.layer("origin");
  venus=thisComp.layer("venus")
  beamlength=length(origin.transform.position, venus.effect("Point Control")("Point"));
  [beamlength,0]
  
  ```
  
  layer *origin* is the original beam. You could do it all on one line, but it would be hella ugly:
  
  ```
  [length(thisComp.layer("origin").transform.position,thisComp.layer("venus").effect("Point Control")("Point")),0]
  
  ```
  
  Beauty is truth.
  
  ![enter image description here](https://i.sstatic.net/hEReD.png)
  
  Since by default the rectangle tool draws rectangles around a central point we need to offset it. In the **Contents>Rectangle 1>Rectangle Path 1>Position** Property (not the layer's position property, that should be the same as the original beam, or the shape's **Contents>Rectangle 1>Transform: Rectangle 1>position** property, that should be 0,0) we offset it by half the width, so that the rectangle's left edge is always at the origin, thus : `content("Rectangle 1").content("Rectangle Path 1").size/2` (did you notice that we're dividing a vector by a scalar? 100 Nerd points to you if you did.)
  
  Now we've got a beam that is the right length, but we need to rotate it. Thank you and good night Pythagoras, hello Mr Aryabhata. Since we know the rise and the run, we can find the angle using Atan(rise/run). But there's some problems: when the run is negative Atan will return a positive value, and whenever the run is 0 the expression will crash. And lastly `Math.atan` returns a result in Radians, so we need to convert it to degrees. So we have to turn a relatively simple expression into this monster, which goes on the **Contents>Rectangle 1>Transform: Rectangle 1>Rotation** Property:
  
  ```
  s=thisComp.layer("venus").effect("Point Control")("Point");
  o=thisComp.layer("origin").transform.position;
  run=s[0]-o[0];
  rise=s[1]-o[1];   
  if (run==0){
   if (rise>0) //pointing straight up
    {-90;}
   else //pointing straight down
    {90;}
  } else{
   if (run>0){
      radiansToDegrees(Math.atan(rise/run));
    } else {
      180+radiansToDegrees(Math.atan(rise/run));
    }
  }
  
  ```
  
  this is how my beam layer looks:
  ![enter image description here](https://i.sstatic.net/SiWGv.png)
  
  and below is the whole comp. I've used shape layers for everything and driven them all by expressions as is my wont, if you want to have a look at it, it's [here](http://adobe.ly/1xy8D30).
  
  ![enter image description here](https://i.sstatic.net/MWjw8.png)
  
  > **Comments:**
  > **username_0**: Stack Exchange suggest I shouldn't say thanks here, but I want to thank you very much for your thorough explanations and I hope you'll see my reply. I have already found a solution for my question thanks to the help of the other responders, but I have bookmarked your post and I will surely use it next time. Thank you very much once again for taking the time to this, I'm very impressed. You can take a look at what I've done [here](https://www.behance.net/gallery/17149469/After-Effects).  
  
  ---
  
  ### Answer by username_2 on 2014-05-13. Score: 3
  
  I would probably start from the smallest orbit and work my way out. If you adjust the anchor point for each object that is rotating, a simple rotation keyframe should make it rotate around the center.
  
  Once you have the smallest thing rotating, you include that composition in another composition and adjust the anchor point similarly to make it rotate around the center of the new composition.
  
  If you need oblong orbits, you can also use a path instead and animate it along the path.
  
  You can keep nesting them indefinitely for as many nestings as you need. It isn't a 100% accurate simulation since the actual orbital mechanics are a bit more complicated, but it gives a simple simulation of them and can easily support various periods for each part.
  
  > **Comments:**
  > **username_0**: Thanks a lot AJ! I will try this tonite, I'm sure it will be helpful.  
  > **username_0**: Thanks again AJ. I can use this trick to create a composition where the beam is static, and then rotate the composition; so I don't need to have the position of the ellipse Venus.  
  
  ---
  
  ### Answer by username_1 on 2014-05-13. Score: 3
  
  You probably want to work with Motion Paths here.
  Though for those to work you need beziere based shapes and not parametric shapes like you have right now. The differences is that parametric shapes (coming from the shape tool (rectangle, ellipse etc.)) are defined by numeric parameters (the part with the first position value in your image). Bezier shapes have points with handles to define the shape, what you get when you draw with the pen tool.
  
  You can use the shape tool to make bezier based shapes and I would recommend that you redo the few shapes you have and simply copy over the settings and keyframes from you existing shapes.
  To make a bezier shape with the shape tool simply hold down the `alt` key while creating the shape.
  Then simply click on the "Path" object in the "Path x" dropdown of your shape.
  ![enter image description here](https://i.sstatic.net/0joG4.png)
  
  Then copy that with Ctrl+C and paste it onto the position of your Venus shape. Either the layers position (the one on the bottom of your screenshot) or the position of the shape itself (the middle one in your screenshot). That will create keyframes for the current outer path of your shape. Then parent the Venus shape to the epicycle shape and the Venus will rotate along the epicycle and move with it. If the Venus is a bit off you can offset the position with either the layer position or the shape position depending on which one you chose to paste the motion path on.
  This will result in an animation like this:
  ![enter image description here](https://i.sstatic.net/wgK7k.gif)
  ![enter image description here](https://i.sstatic.net/rM4g3.png)
  
  I hope thats what you were after.
  If you want to extend the length of the motion path animation just select all the keyframes and drag the last one with the alt key pressed.
  
  To make a connection between Venus and the Epicycle center you have to work with an expression. The easiest way would be to create a null that you parent to Venus and then move the Nulls Anchor Point to the center of the Venus (work from the start frame of the animation to make your life easier). Then apply this expression to one end of the beam effect:
  
  ```
  L = thisComp.layer("Null 1");
  L.toWorld(L.anchorPoint)
  
  ```
  
  "Null 1" being the name of you Null object. This expression gives you the actual global position of your null. If you just use the position value it wont move as these values aren't actually animated right now. We basically get what After Effects is doing in the background to the objects position when parenting an object to an animated layer.
  
  Then simply parent the position of the other end of the beam effect to the position of Epicycle (given that the Epicycle has its Anchor Point centered).
  
  Here is an After Effects example project to understand it more easily.
  
  CS6: <http://www1.zippyshare.com/v/84425880/file.html>
  
  CS5.5: <http://www19.zippyshare.com/v/13633271/file.html>
  
  > **Comments:**
  > **username_0**: Hey, I really appreciate the detailed reply, thank you very much. I'll try this tonight and let you know!  
  > **username_1**: Just ask if you have further questions.  
  > **username_0**: Hello Proffesor FartSparkle! Thanks again for your reply, I used your instructions and you can indeed get a shape to rotate on a circle which is rotating on a circle this way. However, as I see now, there's no way to describe such a path for a shape while using a single position parameter (or how it's called). Our shape will rotate on the circle, and the circle will rotate on another circle, so it's total movement is described by two different layers. If you want to add a beam between the center of the epicycle and Venus, the starting or ending point will only follow one of the two movements.  
  > **username_0**: You can see this illustrated [here](http://s1.postimg.org/khgq0fi3z/ae1.gif)  
  > **username_1**: If you look at the movement of the beams end on the left (the "crosshair" not the visual end of the beam) you see that its going along the epicycle shape but with an offset. I would try to just offset the keyframe animation until it matches the actual position of the epicycle.  
  > **username_1**: Though to make it even easier, just parent that end to the position of the Venus and move the Anchor Point of Venus Shape layer to the center of the shape with the "Pan Behind" tool (right to the camera tool).  
  > **username_1**: Ooh wait, I misunderstood the issue a bit. Let me update the answer with an example project. You have to use an expression here.  
  > **username_0**: Hello Professor FartSparkle! Thank you very much, it would've been a lot harder without your help, hats off to you! I finished it, you can view it here: https://www.behance.net/gallery/17149469/After-Effects?share=1#_=_  
  > **username_0**: That expression does the job indeed, but I didn't need it for the beam. The small beams, from C to Venus and from C to Mars are static, while the epicycles are moving, so it wasn't needed. However! I used your expression for the text "Venus" which is following the point Venus. Previously, I parented it to the point Venus and then I had to manually set keyframes so that the text stays upright. Your expression made this automatic, which is much more fluid and nice! Thank you very much again! Although it's weird that I could not do the same for the "Mars" text, but it's not a big problem.  
  > **username_1**: You will probably have to alter the expression a bit for another object  
  > **username_1**: Nice animation you made there!  
  
  ---
  
  