精彩:JS画的图形[Good篇]
<!--
如果您想在线看看效果:
-->
<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>test</title>
</head>
<STYLE>
v\:* { BEHAVIOR: url(#default#VML) }
</STYLE>
<body>
<v:group ID="group1"
style="position:relative;WIDTH:800px;HEIGHT:600px;top:0;left:0;"
CoordOrig="-500,-500" coordsize="1000,1000">
<v:RoundRect style="position:relative;z-index:1;left:-600px;top:-
580;width:1100px;height:1100px" fillcolor="#cccccc">
<v:shadow on="T" type="single" color="#b3b3b3" offset="5px,5px"/>
</v:RoundRect>
<script>
function line(x, y, x1, y1, n)
{
document.write("<v:line from=\"" + (x - n) + "," + y + "\" to=\"" +
(x1 - n) + "," + y1 + "\" style=\"position:relative;top:-80;left:-50;z
-index:9999;\" strokeweight=\"1pt\"></v:line>");
// StrokeColor=Rgb(\"" + Math.round(Math.random() * 255 ) + "," +
Math.round(Math.random() * 255) + "," + Math.round(Math.random() * 255
) +")
}
var i, j, a;
var length = 1000; // 方块边长
var n = 60, theta = 3; // 每个方块里画子方块的个数,偏移角度值
var x = 300, y = 300; // 原始坐标位置
var py = 800; // x 偏移值
function polygonc(x0, y0, r, n, af)
{
var x, y, xs, ys, i, dtheta, theta;
if(n < 3)return;
dtheta = 6.28318 / n;
theta = af * 0.0174533;
xs = x0 + r * Math.cos(theta);
ys = y0 + r * Math.sin(theta);
var xo = xs, yo = ys;
for ( i = 1; i < n; i++)
{
theta += dtheta;
x = x0 + r * Math.cos(theta);
y = y0 + r * Math.sin(theta);
line(xs, ys, x, y, py);
xs = x;
ys = y;
}
line(xs, ys, xo, yo, py);
}
function block(x, y, a, n, theta)
{
var x0, y0, i, r, t, f, af = 45;
t = Math.abs(theta * 0.0174533);
f = 1 / (Math.cos(t) + Math.sin(t));
r = a / 1.414;
x0 = x + 0.5 * a;
y0 = y + 0.5 * a;
for (i = 1; i <= n; i++)
{
polygonc(x0, y0, r, 4, af);
r = r * f;
af -= theta;
}
}
a = length /4;
for (i = 1; i <= 4; i++)
{
for (j = 1; j <= 4; j++)
{
block(x, y, a, n, theta);
theta = 0 - theta;
x += a;
}
x = 300;
y -= a;
theta = 0 - theta
}
</script>
</v:group>
</body>
</html>
- · VC雕虫小技集(二)
- · VC雕虫小技集(三)
- · VC雕虫小技集(四)
- · VC雕虫小技集(五)
- · VC雕虫小技集(六)
- · VC雕虫小技集(七)
- · 编程语言的异同及选择
- · 流媒体学习笔记----配置一个编码进程
- · 流媒体学习笔记---------编码视频的预览
- · 在VC中动态改变菜单
- · VC++ ADO开发实践之一
- · VC++ ADO开发实践之二
- · VC++ ADO开发实践之三
- · VC++ ADO开发实践之四
- · VC++ ADO开发实践之五
- · VC++ ADO开发实践之六
- · VC++ ADO开发实践之七
- · 图像平滑滚动效果的VC实现
- · VC中给树形控件的图标加上工具提示
- · VC++实现拨号上网程序
- · C++关键字(static/register/atuo/extern/volatile/const)释疑
- · .Net中的反射使用入门
- · 站在面相对象角度小议C++
- · Learn c++ step by step
- · Learn C++ step by step(2)
- · C++中的文件输入/输出(6):一些有用的函数
- · 如何在自己的程序中加入宏的功能
- · 在应用程序中将OJB作为一个存储层使用(一)
- · 在应用程序中将OJB作为一个存储层使用(五)
- · 数据结构学习(C++)续——排序【3】交换排序
- · 也用 C++ 实现 Property 功能
- · 获取网页中的密码和文本输入框的内容
- · 提取网页所有链接
- · 平台+插件软件设计思想及基于COM的原型实现
- · 编写驱动拦截NT的API实现隐藏文件目录
- · 用Visual C++编写电子邮件程序
- · VC实现屏幕变暗效果
- · InstallShield6.3安装文件制作要点
