用笛卡尔公式画出的一颗心状图

王朝other·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

http://www.flash8.net/bbs/UploadFile/2005-6/200563205735695.swf

代码:

var Width = Stage.width;

var Height = Stage.height;

var pen = _root.createEmptyMovieClip("pen_mc", 2);

var ib = 0;

var End = 90;

this.onEnterFrame = function() {

if (ib<End) {

for (j=0; j<End; j++) {

r = Math.PI/45*ib*(1-Math.sin(Math.PI/45*j))*18;

x = r*Math.cos(Math.PI/45*j)*Math.sin(Math.PI/45*ib)+Width/2;

y = -r*Math.sin(Math.PI/45*j)+Height/4;

drawDot(pen, int(x), int(y), 0x00FF00);

//drawCircle(pen, int(x), int(y), 2, 0x000000, 0x00FF00, 0);

}

ib++;

} else {

delete this.onEnterFrame;

}

};

/*ÒòΪֱ½ÓforǶÌ×Ñ­»·FLASHÌ«³ÔÁ¦ÁË¡£¡£ËùÒÔ¸ÄÓÃonEnterFrameÁË...

for (i=0; i<90; i++) {

for (j=0; j<90; j++) {

r = Math.PI/45*i*(1-Math.sin(Math.PI/45*j))*18;

x = r*Math.cos(Math.PI/45*j)*Math.sin(Math.PI/45*i)+AppletWidth/2;

y = -r*Math.sin(Math.PI/45*j)+AppletHeight/4;

drawDot(pen, int(x), int(y), 0x00FF00);

//drawCircle(pen, int(x), int(y), 2, 0x000000, 0x00FF00, 0);

}

}

*/

function drawDot(pen, x, y, DColor) {

pen.moveTo(x-0.5, y);

pen.lineStyle(2, DColor, 100);

pen.lineTo(x+0.5, y);

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航