Home Tutorials Forums Articles Blogs Movies Library Employment Press

 ActionScript.org Forums decaying sinusoidal scaling function
 Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

 06-25-2004, 07:06 PM #1 asc Registered User   Join Date: Jun 2004 Posts: 4 decaying sinusoidal scaling function I've been using a parameterless function to scale movieclips on my site. The drawback to this approach is that every movieclip gets scaled in the same way. I started making a function with parameters and I have it working. The only problem is that I can not see the oscillation. I think it may oscillate too fast. Any way to slow the scaling down? Thanks. -b Here is the actionscript v2. //nGrow-final percent scale value of movieclip. //nElastic-proportional to the number of oscillations. //nSpeed-inversly porportional to the time for the final scale value to reach steady state var isOver:Boolean = true; function sinusoidalScale(nSpeed:Number, nElastic:Number, nGrow:Number, mcClip:MovieClip):Void { trace("nSpeed= "+nSpeed); trace("nElastic= "+nElastic); trace("nGrow= "+nGrow); trace("mcClip= "+mcClip); var nOriginalScale:Number = getProperty(mcBlockOne, _xscale); trace("original scale= "+nOriginalScale); if (isOver) { for (var x = 0; x<=1500; x=x+1) { mcClip._xscale = ((Math.exp(-x/nSpeed)*nGrow*Math.sin(nElastic*x)+nGrow)*100); mcClip._yscale = ((Math.exp(-x/nSpeed)*nGrow*Math.sin(nElastic*x)+nGrow)*100); } var nFinalScale:Number = getProperty(mcBlockOne, _xscale); trace("final scale= "+nFinalScale); } else { nFinalScale = nOriginalScale; nOriginalScale = nOriginalScale/nGrow; var xStart:Number = (-1*(Math.log((nFinalScale-nOriginalScale)/nFinalScale))*nSpeed); trace("xStart= "+xStart); for (var x = xStart; x<=1500; x=x+1) { mcClip._xscale = (nFinalScale*Math.exp(-x/nSpeed)+nOriginalScale); mcClip._yscale = (nFinalScale*Math.exp(-x/nSpeed)+nOriginalScale); } } } //Function call mcBlockOne.onRollOver = function() { trace("Mouse is over Button"); isOver = true; sinusoidalScale(300, .03, 2, mcBlockOne); }; mcBlockOne.onRollOut = function() { trace("Mouse is not over Button"); isOver = false; sinusoidalScale(300, .03, 2, mcBlockOne); };

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is Off HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home ActionScript Forums Group     ActionScript 3.0     ActionScript 2.0     ActionScript 1.0 (and below)     Simple Stuff (Newbies) Flash General Questions     Flash 10 General Questions     Flash 9 General Questions     Flash 8 General Questions     Other Flash General Questions Flex     Flex 2, 3 & 4     Flex 1 Extensions and Plugins     Components     JSFL - Extending Flash Desktop, Mobile and non-browser Environments     AIR (Apollo)     FlashLite / Portable Devices Development     Projectors and CDs Supporting Technologies     HTML and JavaScript     haXe     Server-Side Scripting     Flash Remoting     Flash Media Server General     Best Practices     Gaming and Game Development     Animation and Effects     Flashants Support Forum Community Boards     General Chat     Just for Kicks Challenges     Detention Flash In Action     Site Check     Cool Sites     Widgets Decommissioned     Projects and Positions CMS Forums     Announcements Board     Content Postings / Updates     Product Review Requests     CMS Technical Questions     Process Questions     Collaboration & Suggested Articles

All times are GMT. The time now is 09:15 PM.

///