【发布时间】:2013-04-10 12:38:40
【问题描述】:
以下函数将通过设置位图上的像素来绘制正弦波。但是你怎么把线画得更粗呢?无需借助 Graphics API。
function drawWave(amp:int, freq:int):void
{
for (var i:int = 0; i < stage.stageWidth; i++)
{
var ang:Number = 2 * Math.PI * freq * i/stage.stageWidth;
bmd.setPixel(i, yaxis - amp * Math.sin(ang), 0xff0000);
}
}
【问题讨论】:
-
使用 graphics.lineTo 等将线条绘制到 Shape 对象中(宽度由您选择)。然后使用 bitmapData.draw(shape) 复制整个图形
标签: actionscript-3 math graphics graph bitmap