A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11336 Flash Movies | 2 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Surjit Dhami
» Title: Book
» Description: Book
» More by Surjit Dhami


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

Featured Site

» Posted in the Flash Kit Links section
» Title: All-American Rejects
» Description: Get to know this great band by exploring their "practice room".


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

» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» HTML Photo Gallery Tutorial
» Create your first flash site – PART 1
» How to Make a Flash Photo Gallery
» Unknown Tag: Title10
Random Tutorial | Add Site

Sr Instructional Designer D2L-Moodle,Clearance
WSI Nationwide, Inc.
US-NJ-Fort Monmouth

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.22 Votes: 956
Hits: 3034
» 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
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs