PDA

Click to See Complete Forum and Search --> : drawing sine curves w/ curveTo() or lineTo()



fishea
06-03-2002, 02:28 AM
hi, has anyone tried to draw a sine curve with the flashMX drawing functions? everything I've done with drawTo() is pretty ugly looking. anyone had any sucess w/ this?

-fish

bit-101
06-03-2002, 04:34 PM
lets see...maybe something like...



resolution=10;
wavelength=.5;
amplitude=50;
x=0;
y=200;
lineStyle(1,0,100);
moveTo(x,y);
onEnterFrame=function(){
if(x<550){
lineTo(x, y);
x+=resolution;
angle+=wavelength;
y=200+Math.sin(angle)*amplitude;
}
}


or something like that. play around with the wavelength, resolution and amplitude.