我在网上收集了SVG格式的模式。grid.kevinbock.de
现在我想把它们画在网上会很酷,至少可以用SVG填充一些"onclick=fill“的东西…
我找不到这方面的教程,不知道你是否可以帮助我如何设置这个代码…
下面是一个SVG格式的网格示例:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="50%"
viewBox="0 0 800 600" preserveAspectRatio="xMidYMid slice" width="100%" height="100%" enable-background="new 0 0 800 600" xml:space="preserve">
<polygon fill="none" stroke="#000000" stroke-width="0.25" stroke-miterlimit="10" points="653.458,599.182 653.458,585.273
665.501,592.229 677.546,599.182 665.501,606.135 653.458,613.09 "/>
<polygon fill="none" stroke="#000000" stroke-width="0.25" stroke-miterlimit="10" points="653.458,571.367 653.458,557.461
665.501,564.414 677.546,571.367 665.501,578.32 653.458,585.273 "/>
<polygon fill="none" stroke="#000000" stroke-width="0.25" stroke-miterlimit="10" points="653.458,543.553 653.458,529.646
665.501,536.602 677.546,543.553 665.501,550.508 653.458,557.461 "/>
... and so on...
</svg>进一步的问题是:在网格中绘制线条时,是否有可能出现类似捕捉的情况?在矢量点附近?有没有一种方法可以插入“后退/撤消”-Button并保存文件?
发布于 2013-05-26 20:29:47
为了表明您可以在html代码中使用<svg>标记。要操作svg,可以使用javascript。您可以像处理常规DOM文档一样操作SVG绘图。示例:
<html>
<script>
function colorChange()
{
var el = document.getElementById("mycircle");
el.style.fill = "blue";
}
</script>
<svg>
<circle onClick="colorChange();" id="mycircle" cx="100" cy="50" r="40" stroke="black"
stroke-width="2" fill="red"/>
</svg>
</html>请查看此jsfiddle以查看其实际操作。
https://stackoverflow.com/questions/16759155
复制相似问题