Chapter 3: Trigonometry for Animation

Overview

What well cover in this chapter:

  • What is trigonometry?

  • Angles

  • Trig functions

  • Rotation

  • Waves

  • Circles and ellipses

  • Pythagorean Theorem

  • Distance between two points

  • Important formulas in this chapter

I wanted to put this chapter near the beginning of the book, as youll be using trigonometry extensively for animation techniques, starting with the examples in Chapter 5. In fact, Ill even touch on it in the next chapter on rendering techniques. However, feel free to jump ahead if you already know basic trig or are just anxious to get into animating things. You can always come back here when you come across something you dont understand.

A lot of people shy away from math and trigonometry, saying things like, Im not good with numbers. I can barely add two plus two. The funny thing is that in programming with trigonometry, you are hardly dealing with numbers at all. Its far more in the realm of visualizing shapes and relationships. For the most part, you are dealing with variables containing positions , distances, and angles. You never see the actual numbers . Its mostly a matter of memorizing various relationships. In fact, 90% of the trig you will need for basic animation will come down to two functions: Math.sin and Math.cos .

And, as a disclaimer, and possibly a bit of encouragement, I have to admit that I have no formal math training beyond high school algebra and geometry, most of which I have long forgotten. All of what I am going to relate to you in this chapter is stuff I have learned from various books, websites , and other online resources. The disclaimer part is that its possible that some of what I might say might not hold up in front of a trigonometry professor , and if you are programming some mission-critical rocket launch (something not likely to be done in Flash anyway), youd better pick up a real book on trig. The good news is that I can pretty much guarantee that what I tell you here will work for basic Flash animation. The other good news is that if I can learn this stuff, so can you.



Foundation ActionScript. Animation. Making Things Move
Foundation Actionscript 3.0 Animation: Making Things Move!
ISBN: 1590597915
EAN: 2147483647
Year: 2005
Pages: 137
Authors: Keith Peters

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net