【发布时间】:2015-05-10 18:44:45
【问题描述】:
我想使用剪辑路径将图像暴露在另一个图像后面。
我正在使用 svg 圆形元素。我想要的结果是柔和的渐变边缘,而不是 clipPath 提供的硬边缘。
这可能吗?我知道我可以使用蒙版来做到这一点,但似乎无法让它与 clipPath 一起使用。
到目前为止,这是我的代码:
<svg id="mysvg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 500 500">
<defs>
<radialGradient id="grad" cx="50%" cy="50%" r="50%">
<stop stop-color="white" offset="0%"/>
<stop stop-color="black" offset="100%"/>
</radialGradient>
<clipPath id="clip1" >
<circle cx="0" cy="0" r="30" fill="url(#grad)" />
</clipPath>
</defs>
<image id="darkMap" xlink:href="images/darkMapSml.jpg" width="100%" height="100%" ></image>
<image id="topImg" xlink:href="images/lightMapSml.jpg" width="100%" height="100%" clip-path="url(#clip1)" />
</svg>
【问题讨论】: