使用SnapSVG的响应SVG路径 [英] Responsive SVG Path with SnapSVG
本文介绍了使用SnapSVG的响应SVG路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用 SnapSVG / a> ?
我已构建了以下 在CodePen上进行实验 ,任何我想让我的路径
回应。
我使用笔的第9行上的以下代码构建路径:
var myPathC = snapC.path(M62.9 14.9c-25-7.74-56.6 4.8-60 ...
然而,这是我希望在浏览器窗口调整大小时响应或重绘的路径。任何人知道这是否可能和/或有关于如何处理它的任何想法?
解决方案
为容器提供viewBox属性,例如
< svg id =svgCwidth =100%height =100%viewBox =0 0 600 400>< / svg>
/ pre>
,它会随着窗口大小调整。
Is it possible to have a responsive
path
using SnapSVG?I have built the following experiment on CodePen, any i want my
path
to be responsive.I'm building my path using the following code on line 9 of my pen:
var myPathC = snapC.path("M62.9 14.9c-25-7.74-56.6 4.8-60...
However it is this path that i wish to be responsive or re-drawn when the browser window is resized. Anyone know if this is possible and/or have any ideas on how to approach it?
解决方案Give the container a viewBox attribute e.g.
<svg id="svgC" width="100%" height="100%" viewBox="0 0 600 400"></svg>
and it will resize with the window.
这篇关于使用SnapSVG的响应SVG路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文