以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 SVG/GML/VRML/X3D/XAML 』 (http://bbs.xml.org.cn/list.asp?boardid=21) ---- 请问:如何在svg中用path模拟实现sin/cos等数学函数的显示? (http://bbs.xml.org.cn/dispbbs.asp?boardid=21&rootid=&id=35170) |
-- 作者:mingwei_zhou -- 发布时间:7/3/2006 4:49:00 PM -- 请问:如何在svg中用path模拟实现sin/cos等数学函数的显示? 如题! 谢谢~ |
-- 作者:mingwei_zhou -- 发布时间:7/4/2006 10:54:00 AM -- 不知sin等数学函数的绘制是否与贝塞尔曲线有某种关系? |
-- 作者:welfred -- 发布时间:7/4/2006 5:36:00 PM -- 直接写TEXT不行吗 |
-- 作者:mingwei_zhou -- 发布时间:7/5/2006 10:57:00 AM -- 我的意思是 模拟sin曲线的绘制 |
-- 作者:welfred -- 发布时间:7/5/2006 12:03:00 PM -- SORRY,我理解错了。我想没有什么太好的方法,描出关键点,然后用平滑的曲线连接起来吧。 |
-- 作者:mingwei_zhou -- 发布时间:7/5/2006 12:46:00 PM -- 我也是这样想的 但是就是不知道关键点如何选取? 不知道是否可以修改贝塞儿曲线的关键点 来实现模拟sin |
-- 作者:tamefox -- 发布时间:7/6/2006 9:51:00 PM -- <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-flat-20030114.dtd"> <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"> <desc> <!-- put a description here --> </desc> <script type="text/javascript"><![CDATA[ var k=(2*3.1415926)/300; str=""; for(var i=0;i<=300;i++){ str+=(100+i)+' '+(300-Math.sin(i*3.1415/150)*200)+" "; } var node=document.createElement("polyline"); node.setAttribute("points",str); node.setAttribute("style","fill:none;stroke:red"); document.getElementById('q').appendChild(node); str=""; for(var i=0;i<=300;i++){ str+=(100+i)+' '+(300+Math.sin(i*3.1415/150)*200)+" "; } var node=document.createElement("polyline"); node.setAttribute("points",str); node.setAttribute("style","fill:none;stroke:green"); document.getElementById('q').appendChild(node); ]]></script> <g id="q"> <line x1="100" y1="300" x2="500" y2="300" /> <line x1="100" y1="100" x2="100" y2="500" /> </g> </svg> |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
46.875ms |