PHP - 如何根据transform属性修改SVG路径的“d”属性?

时间:2016-10-13 21:22:42

标签: javascript php html svg

我有一个<div id="parent"> <p id="p1">Long block that only appears on the top</p> <div>Maximising Div</div> <p id="p2">Long block that only appears on the bottom</p> </div>文件,其中包含一个路径元素。

此路径元素具有一些变换(在本例中为缩放变换)。然后我需要删除SVG属性,但通过修改transform的{​​{1}}属性来获得相同的视觉效果。我需要d中的解析函数来转换path属性。

例如,鉴于此JSFiddle

PHP

我想要类似的东西:

d

属性:<svg width="155" height="600" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" > <rect x="0" y="0" width="155" height="600" style="fill:#00aa00" /> <path transform="scale(0.5)" style="fill:#ffffff;" d="M 47.00,485.00 C 60.45,487.57 58.50,500.79 50.96,503.99 46.94,505.70 43.79,504.42 40.00,503.00 40.00,503.00 34.00,511.21 34.00,511.21 34.00,511.21 30.35,519.61 30.35,519.61 30.35,519.61 20.00,529.00 20.00,529.00 27.74,533.52 23.11,538.41 25.00,546.00 32.41,543.22 41.77,543.71 41.79,554.00 41.80,557.04 40.17,560.23 39.00,563.00 50.77,569.87 39.05,586.63 28.21,578.99 25.89,577.36 25.15,575.45 24.00,573.00 9.36,577.01 10.32,562.56 9.77,560.00 9.14,557.12 7.57,555.10 7.47,552.00 7.47,552.00 7.47,545.58 7.47,545.58 7.32,543.00 4.82,540.39 5.25,536.00 5.58,532.75 7.19,530.56 9.00,528.00 1.51,523.62 3.53,516.11 9.00,511.00 0.44,506.00 3.80,496.83 12.00,493.00 6.57,481.25 15.48,473.19 28.00,480.00 33.67,470.57 45.66,472.49 47.00,485.00 Z"/> </svg> 已经消失,但获得了相同的视觉效果。

0 个答案:

没有答案