<- A "sine wave"
(for the remainder of this tutorial I will refer to sine by it's common abbreviation "sin".
Well, Macromedia flash has this mathmatical function all nicely coded up for you (TRUST ME, we don't want to start working with the power series that is used in the calculation of sin). Sin works by taking in a parameter and giving back a number between -1 and 1. As we tell it where on the X-axis we want current Y. For math haters: this simply means we read the wave from left to right, each position has a particular number, at each given position, the sin function tells us where to put the ball.
So, let's lay out the dots. What we want to do first is actually graph out the sin wave. We can do this by asking the sin function how high (between -1 and 1) should each ball be. But between -1 and 1 is a small small graph! So let's scale it by a variable factor. This way we can increase the size at a whim.
Increment the x-axis value and then call the corrisponding Y axis value as the sin(someStartValue + x * PI/180).
You multiply by PI/180 to convert to radians.
This will give us the sin wave, made up of the balls we have supplied. If you don't know how to do duplication of movie clips, you must first get the hang of that, and basic flash programming before truly understanding this system in the code sense, but anyone should understand how it works in a hypothetical sense.
| » Level Intermediate |
|
Added: 2004-09-12 Rating: 4 Votes: 39 |
| » Author |
| Please visit my site and/or email me if you want more tutorials from me! |
| » Download |
| Download the files used in this tutorial. |
| Download (6 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


Comments
There are no comments yet. Be the first to comment!