<!--
如果您想在线看看效果:.NET/test/1.htm">http://m9m.nease.net/test/1.htm
-->
XMLns:v="urn:schemas-microsoft-com:vml">
function line(x, y, x1, y1, n)
{
document.write("");
// StrokeColor=Rgb("" + Math.round(Math.random() * 255 ) + "," + Math.round(Math.random() * 255) + "," + Math.round(Math.random() * 255 ) +")
}
var n = 30, r = 346, t = 6.28318 / n, x0 = 300, y0 = 300;
var x = new Array();
var y = new Array();
for (var i = 0; i < n; i++)
{
x[i] = r * Math.cos(i * t) + x0;
y[i] = r * Math.sin(i * t) + y0;
}
for (var i = 0; i < n - 2; i++)
for (var j = i + 1; j <= n - 1; j++)
line(x[i], y[i], x[j], y[j], 500);
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-962323/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10752043/viewspace-962323/
本文介绍了一种使用JavaScript绘制复杂金刚石图形的方法。通过数学计算和随机颜色填充,实现了动态生成独特图形的效果。该示例提供了完整的代码实现,并可在提供的链接中查看在线演示。
1443

被折叠的 条评论
为什么被折叠?



