数学函数 Math.sin() 曲线问题

      课件教程 2006-7-3 0:30
数学函数 Math.sin() 曲线问题.代码如下:

//定义画线函数代码
function drawSin(qiDianX, qiDianY, kuaDu, zhenFu, suDu, zhouQi) {
i = 0;
createEmptyMovieClip("mc", 5);
with (mc) {
lineStyle(2, 0x00ff00, 100);
moveTo(100, 50);
lineTo(100, 300);
moveTo(50, 200);
lineTo(480, 200);
moveTo(Number(qdx.text), Number(qdy.text));
lineStyle(1, 0xff0000, 100);
}
onEnterFrame = function () {
x = qiDianX+i*kuaDu;
y = qiDianY-zhenFu*Math.sin(i*Math.PI/180);
mc.lineTo(x, y);
i += suDu;
if (i>360*zhouQi) {
delete _root.onEnterFrame;
}
};
}

//定义按钮的代码
aa.onPress = function() {
drawSin(Number(qdx.text), Number(qdy.text), Number(kd.text), Number(zf.text), Number(sd.text), Number(zq.text));
};

//设定初始值
qdx.text = "100";
qdy.text = "200";
kd.text = "0.5";
zf.text = "150";
zq.text = "2";
sd.text = "5";

aa.onPress();//模拟点击一下,开始画图.
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}