如何使用raphaeljs中的rect元素剪辑内容?
问题描述:
如何使用rapaheljs可以使用rect
元素剪切内容?我通过手动创建元素来实现这一点。我创建的标记在下面给出,现在我想用raphaeljs做到这一点。如何使用raphaeljs中的rect元素剪辑内容?
<clipPath id="clipper">
<rect x="0" y="0" height="160" width="250"/>
</clipPath>
<g clip-path="url(#clipper)">
...
...
</g>
或者是否有任何其他方法使用rapaheljs创建这样的裁剪矩形? 任何帮助,将不胜感激。谢谢。
答
在拉斐尔这是怎么了:
elm.attr({clip-rect: "0 0 160 160"})
...其中榆树是在您的示例<克>元素。
[raphael js crop image]的可能重复(http://stackoverflow.com/questions/7948866/raphael-js-crop-image) – 2012-03-01 12:11:41