# Perfect Orbit.. anyone got the code?

**URL:** https://forum.kirupa.com/t/perfect-orbit-anyone-got-the-code/2627
**Category:** flash
**Created:** [May 22, 2002, 12:30pm UTC](https://forum.kirupa.com/t/perfect-orbit-anyone-got-the-code/2627 "2002-05-22T12:30:17Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 22, 2002, 12:30pm UTC](https://forum.kirupa.com/t/perfect-orbit-anyone-got-the-code/2627/1 "2002-05-22T12:30:17Z")

</div>

I’m looking for movement code that will give me a perfect orbit for an object around a point.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 22, 2002, 5:48pm UTC](https://forum.kirupa.com/t/perfect-orbit-anyone-got-the-code/2627/2 "2002-05-22T17:48:39Z")

</div>

```auto
 
MovieClip.prototype.orbit = function(spd,r,xCen,yCen){
&nbsp &nbsp &nbsp &nbsp this.s+=spd;
&nbsp &nbsp &nbsp &nbsp this._x = Math.cos(this.s)*r + xCen;
&nbsp &nbsp &nbsp &nbsp this._y = Math.sin(this.s)*r + yCen;
}

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2002, 12:50am UTC](https://forum.kirupa.com/t/perfect-orbit-anyone-got-the-code/2627/3 "2002-05-23T00:50:45Z")

</div>

thanks supra… you’re supra 😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2002, 3:11am UTC](https://forum.kirupa.com/t/perfect-orbit-anyone-got-the-code/2627/4 "2002-05-23T03:11:18Z")

</div>

you know… I’m really really enjoying the prototype method building. I have been using a lot of attachMovieClip(); methods lately, but often need to add code to them all, rather than go through clumsy loops and such.

Now here’s another two questions for you.

I’d like to scale my object down on one half lap of the loop, and scale it back up on the other half of loop. Obviously I’m trying to make it look like a real

how do I plot a curve from a center point, to an ever expanding radius?
