Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Master Simple Math Concepts to Electrify Your ActionScript  : Page 3

I know we said there would be no math, but this is way easier than it sounds. This practical article uses basic trigonometry in ActionScript to improve the flexibility and creativity of your animations. After this down-to-earth tutorial, you may never shy away from math again.


advertisement
More Examples
I've also included two more examples in the downloadable source code, but they use almost exactly the same code. This shows how versatile the code can be and how easy the math is to use.

The second example does nothing more than add another MovieClip that uses the same code, but continuously centers the second MovieClip around the first. This results in a satellite around the satellite, much like the Moon revolving around the Earth while the Earth revolves around the Sun (albeit with perfectly circular orbits). The effect can be interesting. Try varying the values of angleChange and radius for the second MovieClip and see how that changes the animation.

The third example goes back to one MovieClip but adds a subtle wrinkle by varying the value of radius during the animation. The effect is a spiral animation path--first in and then back out.



When you're comfortable with the changes that make these animations unique, you can download two additional samples from my Web site (http://www.fmaonline.com/devx/) to move on to something slightly more complicated. One will orbit the MovieClip around the mouse, instead of the center of the stage, and the other will use the same circle math to create an interesting dynamic interface. It will take a random number of buttons and place them, equidistantly, around the circular path you've created. Trust me, it's easy!

Was I Right?
I hope you agree that, if you learn the small bits and pieces of math that are most relevant to your needs, you can gain great benefits with relatively small amounts of pain. If you liked this article, let me know. If there is enough interest, I can move on to things like gravity, springs, friction, collisions and more—all of which will be much easier than you think and will add tons of creative options to your Flash animations!



Rich Shupe is president of FMA, a full-service multimedia development and training facility based in New York. He is a regular Flash columnist for DevX and coauthor of the upcoming "Flash 8: Projects for Learning Animation and Interactivity" and the upcoming "Learning ActionScript 3.0," (both published by O'Reilly). FMA develops web and disc-based products for clients including McGraw-Hill, Phillips, 20th Century Fox, and Nickelodeon, and trains digital media professionals in Flash, ActionScript, HTML, JavaScript, and more.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap