A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11303 Flash Movies | 7 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Nitin Tikhe
» Title: Cart
» Description: This Animation Tut is a fun and useful for kids below 15 years. Watch the Flag, Doors, Stick and Horse movements.
» More by Nitin Tikhe


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 6008 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: Banana Swimwear
» Description: This is a banana swim wear interactive catalog we designed and animated in Flash


Random Links | Add your own Flash Related Links
Flash Tutorials 1255 Tutorials 7 New Tutorials Added!
What's New | Top100

» Make flash video player for broadcasting live streaming video / TV on website
» How to convert the project file of Flash Demo Builder 2.0 into FLV file
» FLV to PSP for Mac - How to convert YouTube video to PSP on mac
» How to Convert FLV to MP4 for Playback on iPod
» how to download and convert youtube video to AVI with Leawo Free FLV converter
» Flash Multi-player Game Tutorial - TicTacToe
» How to make Flash elearning tutorials with screen recorder?
» Fader API:Slideshow with MovieClips on stage
» How to convert MS PPT file into an FLV File
» Unknown Tag: Title10
Random Tutorial | Add Site

Network Design Manager
The Computer Merchant, Ltd
US-VA-Hampton

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Math-Physics

Categories Creation of a pendulum with dynamic parameters in Flash
Author: Michele Microon | Website: http://www.microon.com |

 
Page 6
«prev 1 2 3 4 5 6 7 8 9 10 11 12 next»

Mathematical functions

What it determines the new value of rotation that our pendulum will have on every instant - i.e. frame - it is the associated mathematical function. It is well know that the function sine has an oscillating course, but constant in the time, and that it oscillates between values +1 and -1; therefore if we associate the simple function sine to the rotation of the pendulum, where the rotation value is given instant to instant - frame to frame - from the value that assumes sin(a) (a is our quarter variable, that it increases to every frame), the pendulum will oscillate between +1 degree and -1 degree, too much little for being appreciated visually:

this is the reason for which we use the variable maxang: it works as multiplier of sin(a); if sin(a) oscillates between +1 and -1, and we give maxang to a value of 60, then

maxang*sin(a)

it will oscillate between +60 (degrees) and -60 (degrees).

Notes: according to ActionScript syntax it must write maxang*(Math.sin(a))

Now we want that the pendulum does not oscillate forever, but that it stops its movement, gradually. In order to realize this, we need a function that multiplied to "maxangle*sin(a)", at the beginning it does not have influence but with passing of the time reduces the oscillation until 0 (that is pendulum stopped). Moreover this function must have an effect that carry gradually to 0: the perfect function for this result is just the power function, that is

n^a

where n it is a real number>0. It is well know that the function power has these property:

 

  • if n>1 it has increasing graph;
  • if 0<n<1 it has decreasing graph, and if a is "much large" the function catches up the 0 (and therefore multiplied for "maxangle*sin(a)", when a is "much large", it reduces the oscillation to 0);
  • se n=1 it is constant of constant value 1;
  • for a=0 it assumes value 1 any is the value of n (and therefore multiplied for "maxangle*sin(a)" at the beginning, when a=0, it does not have influence.

For how much said, it appears clearly that we must choose an n, than in our case it will be the timesmorz variable, than 0timesmorz<1); if n=1 the power function is always 1 and the oscillation does not come influenced (infinite oscillation). How varies the power function when we modify n between 0 and 1? More next to value 1 is n, slower will be the convergence to the 0, like well demonstrates the figure here under:

 

Notes: according to ActionScript syntax it must write Math.pow(timesmorz,a)

Now we can create the final function, that it encloses sin and power: according to ActionScript syntax it will be

((Math.sin(a))*(Math.pow(timesmorz,a))*maxang

 

What about the n_osc variable? It is used in the function in this mode:

Math.sin(n_osc*a)

its duty is to increase the number of totals oscillations that happen in the same arc of time. Example: if n_osc=1 we will have 20 oscillations in 10 sec, if n_osc=2 we will have 40 oscillations in 10 sec and so on. So, the effect of this variable is, for the final motion, of having a "slow-motion" if n_osc<1 and an accelerated one to the growing of n_osc>1. The definitive function used in the movie is:

((Math.sin(n_osc*a))*(Math.pow(timesmorz,a))*maxang

 

«prev 1 2 3 4 5 6 7 8 9 10 11 12 next»

» Level Advanced

Added: : 2001-01-18
Rating: 9.23 Votes: 954
Hits: 3033
» Author
No author details given.
» Download
Download the files used in this tutorial.
Download (67 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments