Re: [Flashcoders] seeking :: Oscillating SineWaves via Drawing API -let's get some some fun
Here is a slight modification: What will be next steps? If you want smoother curves and fewer points, and can wait a bit (I'm pretty busy today), I've written some code a while back that will convert a sequence of points into a smooth cubic bezier curve. IIRC, curveTo uses quadratic beziers, but the same principle should apply pretty well. If you can't wait, then check out the matrix form of Catmull-Rom splines. Danny ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] seeking :: Oscillating SineWaves via Drawing API - let's get some some fun
Here is a slight modification: What will be next steps? var mc = this.createEmptyMovieClip( "mc", 11); onEnterFrame = function () /* t - time (x,y) */ { var t = getTimer()/1000; //100 var x0=0, x1 = Math.PI*10; var imax = 100; var xy = getData( this, myFunction, x0, x1, t, imax);// drawLine (mc, xy); } // -- function myFunction ( x, t) { return x*Math.sin(x*t) } // -- function getData ( this_o:Object, func:Function, x0 :Number, x1 :Number, t:Number, imax :Number) :Array { var x, dx = (x1-x0)/(imax-1); var xy = new Array (); for (var i=0; i- Original Message - From: "Martin Wood" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" Sent: Friday, February 17, 2006 6:14 PM Subject: [Bulk] Re: [Flashcoders] seeking :: Oscillating SineWaves via Drawing API its quick and its dirty but it should give you something to work with : for(var n=0;n<3;n++) { var sinewave:MovieClip = _root.createEmptyMovieClip("sinewave" + n,n+1); sinewave._y = 100; sinewave.phase = n * 10; sinewave.frequency = ((n + 1) * 5) / 50; sinewave.amplitude = 60 - (n * 10); sinewave.speed = (n + 1) / 5; sinewave.heightDeviation = Math.random() * 30; sinewave.onEnterFrame = function() { this.phase+=this.speed; _root.drawSineWave(this,this.phase,this.amplitude + (Math.sin(this.phase) * this.heightDeviation),this.frequency); } } function drawSineWave(mc:MovieClip, phase:Number, amplitude:Number, frequency:Number) { var numPoints:Number = 80; var width = 550; mc.clear(); mc.lineStyle(2,0,100); var y:Number = Math.sin(phase * frequency) * amplitude; mc.moveTo(0,y); var dx:Number = width / numPoints; for(var x=0;x its 3 waves that need to appear randomly oscillating in height.. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] seeking :: Oscillating SineWaves via Drawing API
woohoo! this is perfect! u da man! thanks Martin! a ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] seeking :: Oscillating SineWaves via Drawing API
its quick and its dirty but it should give you something to work with : for(var n=0;n<3;n++) { var sinewave:MovieClip = _root.createEmptyMovieClip("sinewave" + n,n+1); sinewave._y = 100; sinewave.phase = n * 10; sinewave.frequency = ((n + 1) * 5) / 50; sinewave.amplitude = 60 - (n * 10); sinewave.speed = (n + 1) / 5; sinewave.heightDeviation = Math.random() * 30; sinewave.onEnterFrame = function() { this.phase+=this.speed; _root.drawSineWave(this,this.phase,this.amplitude + (Math.sin(this.phase) * this.heightDeviation),this.frequency); } } function drawSineWave(mc:MovieClip, phase:Number, amplitude:Number, frequency:Number) { var numPoints:Number = 80; var width = 550; mc.clear(); mc.lineStyle(2,0,100); var y:Number = Math.sin(phase * frequency) * amplitude; mc.moveTo(0,y); var dx:Number = width / numPoints; for(var x=0;x its 3 waves that need to appear randomly oscillating in height.. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] seeking :: Oscillating SineWaves via Drawing API
its 3 waves that need to appear randomly oscillating in height.. Could could just draw a few sinewaves, duplicate them at different yscale, etc. and then have them loop? Is it supposed to fake something in particular or just some random sinewaves? Multiple non-changing but differnet waves? Or is it 1 wave that needs to change a lot? On 2/17/06, artur <[EMAIL PROTECTED]> wrote: sorry for the repost but.. im a bit under the gun...and i looked EVERYWHERE! i need a drawing api function or fla that can produce multiple flowing sinewaves. the waves should be random in oscillating and appear to be flowing organically. please help! thanks artur ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] seeking :: Oscillating SineWaves via Drawing API
Could could just draw a few sinewaves, duplicate them at different yscale, etc. and then have them loop? Is it supposed to fake something in particular or just some random sinewaves? Multiple non-changing but differnet waves? Or is it 1 wave that needs to change a lot? On 2/17/06, artur <[EMAIL PROTECTED]> wrote: > > sorry for the repost but.. > > im a bit under the gun...and i looked EVERYWHERE! > > i need a drawing api function or fla > that can produce multiple flowing sinewaves. > the waves should be random in oscillating and appear to be flowing > organically. > > please help! > > thanks > > artur > > > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] seeking :: Oscillating SineWaves via Drawing API
sorry for the repost but.. im a bit under the gun...and i looked EVERYWHERE! i need a drawing api function or fla that can produce multiple flowing sinewaves. the waves should be random in oscillating and appear to be flowing organically. please help! thanks artur ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com