搜索
 找回密码
 加入

代码生成的花瓣(JS里可以使用数学三角函数!!)

yellky 2007-3-5 19:07:12 2049
<script>
function drawp(x,y,color)
{
        document.write("<hr style='position: absolute; left: "+(x+300)+"; top: "+(y+200)+";color: "+color+"' src='px.gif' size=2 width=2px>")
}


for(t=1;t<=360;t++)
{
        lo=200 * Math.sin(2 * (Math.PI / 180) * t);
        x = lo * Math.cos((Math.PI / 180) * t);
        y = lo * Math.sin((Math.PI / 180) * t);
        drawp(x,y,"#0000ff");
        lo=200 * Math.cos(2 * (Math.PI / 180) * t);
        x = lo * Math.cos((Math.PI / 180) * t);
        y = lo * Math.sin((Math.PI / 180) * t);
        drawp(x,y,"#336600");
}
</script>
  1. <script>
  2. function drawp(x,y,color)
  3. {
  4.         document.write("<hr style='position: absolute; left: "+(x+300)+"; top: "+(y+200)+";color: "+color+"' src='px.gif' size=1 width=1px>")
  5. }


  6. for(t=1;t<=360;t++)
  7. {
  8.         lo=200 * Math.sin(2 * (Math.PI / 180) * t);
  9.         x = lo * Math.cos((Math.PI / 180) * t);
  10.         y = lo * Math.sin((Math.PI / 180) * t);
  11.         drawp(x,y,"#000000");
  12.         lo=200 * Math.cos(2 * (Math.PI / 180) * t);
  13.         x = lo * Math.cos((Math.PI / 180) * t);
  14.         y = lo * Math.sin((Math.PI / 180) * t);
  15.         drawp(x,y,"#ff0000");
  16. }
  17. </script>
复制代码

3 回复

admin
2007-3-5 18:38:42
点击查看详情
强人,可惜颜色不怎么好,要是能搞成蓝色的或者其他的颜色就好了
yellky
2007-3-5 19:03:00
楼主
怎么删除回复??

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML xmlns:v="urn:schemas-microsoft-com:vml">
  3. <head>
  4. <xml>
  5. <MSHelp:Keyword Index="A" Term="vmltext4"/>
  6. </xml>
  7. <TITLE>VML text</TITLE>
  8. <style>
  9. v\:* { behavior: url(#default#VML); }
  10. </style>

  11. </head>

  12. <BODY BGCOLOR="#FFFFFF">

  13.         <v:shape style="position: absolute; top: 25px; left: 5px;
  14.                  width: 300px; height: 300px; antialias: true"
  15.                  coordsize="300,300">
  16.                 <v:path textpathok="True" v="m 0,0 l 300,200" />
  17.                 <v:fill on="True" color="#999999"/>
  18.                 <v:stroke on="false" />
  19.                 <v:textpath
  20.                         on="True"
  21.                         fitpath="true"
  22.                         string="Where do you want to go today?"
  23.                         style="font:normal normal bold 12pt Arial" />
  24.         </v:shape>

  25. </BODY>
  26. </HTML>
复制代码


  1. <html xmlns:v>
  2. <style>
  3. v\:*{behavior:url(#default#VML)}
  4. </style>
  5. <body>
  6. <div style="POSITION: absolute">

  7. <DIV id=div1 style="CURSOR: default; POSITION: absolute;left:100">
  8. <v:shape title="" style="WIDTH: 1px; POSITION: absolute; HEIGHT: 1px" coordsize = "1,1" fillcolor = "black" strokecolor = "#8b0101" strokeweight = "0" path = " m80,110 qx50,150,100,195,150,150,120,110 l100,115 x e"><v:fill type = "gradient" opacity = "1" angle = "135" method = "sigma" colors = "39321f red"></v:fill><v:shadow on = "t" type = "emboss" opacity = "52428f" offset = "2.25pt,2.25pt" offset2 = "3.75pt,3.75pt"></v:shadow></v:shape><v:shape title="" style="WIDTH: 1px; POSITION: absolute; HEIGHT: 1px" coordsize = "1,1" fillcolor = "#0c0" strokecolor = "#004600" strokeweight = "0" path = " m110,90 c120,50,150,60,170,60 xe"></v:shape><v:shape title="" style="WIDTH: 1px; POSITION: absolute; HEIGHT: 1px" coordsize = "1,1" fillcolor = "#090" strokecolor = "#004600" strokeweight = "0" path = " m170,60 c160,90,140,100,110,90 xe"></v:shape><v:line style="LEFT: 0px; POSITION: absolute; TOP: 0px" from = "82.5pt,67.5pt" to = "72.75pt,72.75pt" strokecolor = "#004600" strokeweight = "0"><v:stroke startarrow = "none" endarrow = "none"></v:stroke></v:line><v:curve style="LEFT: 0px; POSITION: absolute; TOP: 0px" from = "63.75pt,60pt" control1 = "75pt,67.5pt" control2 = "75pt,86.25pt" to = "75pt,86.25pt" strokecolor = "#8b0101" strokeweight = "2pt">
  9. </div>
  10. <div style=height:400></div>
  11. </body>
复制代码
yellky
2007-3-5 19:07:12
楼主
原帖由 admin 于 2007-3-5 18:38 发表
强人,可惜颜色不怎么好,要是能搞成蓝色的或者其他的颜色就好了



汗~~自己看代码

里面有定义颜色的地方
高级模式
游客