Planetary Orbits: Elliptical Animations with ActionScript
Bringing some degree of realism to a simulation of planetary orbits requires elliptical, not circular, paths. This article will show you how to create them. Also included is a major execution order "gotcha" that you may not be aware of!
by Rich Shupe
July 25, 2005
ast month I tried to encourage readers to embrace a couple of simple math concepts to expand the ol' ActionScript skill set. I tried to show that by understanding some basic trigonometry (just sine and cosine, honest!) you could be wielding the power of the circle in no time. If you want to prime the pump for this month's fun, you can check out last month's article before continuing, but it's not strictly necessary.
The idea behind my last article was to attempt to diminish the trepidation some users have about "using a lot of math" in scripting. I sometimes have the same problem, and I have to dig a little before I can get my head around a concept. So, I tried to create a handful of examples that build one upon the other, adding features in each new demonstration. One file, for instance, showed how to animate a MovieClip in a circle. Another example simply animated a second MovieClip around the first, while the first was moving in a circle of its own. The effect was a very primitive model crudely similar to the Moon orbiting around the Earth while the Earth orbited around the Sun.
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!