我试图用线构建一个圆。每条线从圆的中心开始,与圆的半径一样长。使用循环以及正弦和余弦波,我可以使用正弦和余弦构建圆以标记lineTo
参数的坐标。ActionScript lineStyle填充一个圆的厚度
我的问题是线条粗细参数lineStyle
。无论圆的周长有多大,我都希望线条的末端完美匹配,但我无法找出线条厚度的适当方法。
//this is what makes sense to me, but it still creates some gaps
lineThickness = 1 + (((nRadius * 2) * Math.PI) - 360)/359;
for(var i:int = 0; i < 360; i++)
{
// Convert the degree to radians.
nRadians = i * (Math.PI/180);
// Calculate the coordinate in which the line should be drawn to.
nX = nRadius * Math.cos(nRadians);
nY = nRadius * Math.sin(nRadians);
// Create and drawn the line.
graphics.lineStyle(lineThickness, 0, 1, false, LineScaleMode.NORMAL, CapsStyle.NONE);
graphics.moveTo(0, 0);
graphics.lineTo(nX, nY);
}
为了使线路的两端在圆圈周长迎了上来,没有任何差距,我需要扩大线路,以填补在剩余的空间。对我而言有意义但不起作用的是从圆周中减去360,然后将该数字除以行之间的空槽数量(即359)并将该数字加上1的厚度。
关于我的是,lineStyle
厚度参数是Number
,但似乎只取0到255之间的值,所以我不确定像1.354这样的浮点数是否是有效厚度。
我想我明白你想达到什么样的,但我真的不明白为什么* *? (我只是好奇) – grapefrukt 2010-05-19 12:25:37
它是这样我可以访问每行的颜色值 – TheDarkIn1978 2010-05-19 12:35:48