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<numPoints;x++)
{
y = Math.sin((phase + x) * frequency) * amplitude;
mc.lineTo(x * dx,y);
}
}
you can just stick this into the first frame of an .fla
let me know if you need some explanations.
thanks,
Martin
artur wrote:
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