Groups | Blog | Home
all groups > flash actionscript > december 2005 >

flash actionscript : sine wave


hatsi59
12/7/2005 11:00:56 PM
Hi All,
can someone tell me how to go about drawing a sine wave with actionscript. Also I want to take the amplitude and use it for drawing other items.

Many thanks
George
kglad
12/7/2005 11:31:35 PM
function sinF(amp, inc) {
clearInterval(drawI);
x = 0;
_root.createEmptyMovieClip("holderMC", 1);
holderMC.lineStyle(1, 0x000000);
holderMC.moveTo(0, 0);
drawI = setInterval(drawF, 1, amp, inc);
}
function drawF(amp, inc) {
trace(x);
with (holderMC) {
lineTo(10*x, 10*amp*Math.sin(x));
}
x += inc;
updateAfterEvent();
}
sinF(3, .1);
hatsi59
12/7/2005 11:45:33 PM
thanks so much for sharing your expertise. I will no doubt need to get a deeper
understanding as time goes by. Can you suggest any online tuts or the like for
these types of maths drawing exercises?

Many thanks
George
AddThis Social Bookmark Button