html - 如何在 SVG 路径创建中使用变量?

标签 html svg

我正在使用 Raphael 库和以下代码创建 SVG 路径:

this.resultsBoxLine1 = paper.path("M42 10L42 36");

我想用变量来指定路径的位置,但是我不能这样写:

this.resultsBoxLine1 = paper.path("MmyVar11 myVar2LmyVar3 myVar4");

有人知道我该怎么做吗?

最佳答案

或者

this.resultsBoxLine1 = paper.path("M{0} {1}L{2} {3}", myVar11, myVar2, myVar3, myVar4);

关于html - 如何在 SVG 路径创建中使用变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3094335/

相关文章:

html - 匹配文本内容并应用样式

javascript - 是否可以在 SVG 中进行下标?

javascript - Firefox window.innerHeight 太小

html - CSS 过渡缓入出不起作用

javascript - 单击时将输入值添加到 html 属性

html - 在移动设备上水平滚动仅针对某些容器而不是整个页面

c# - 如何编写多行 RegEx 表达式

javascript - D3 折线图上的标签不起作用

javascript - jQuery 的 textpath svg 元素有问题

javascript - svg 到 json.js |我的文件去哪儿了?