SVG阴影效果使用示例

在SVG中, 为了显示阴影效果, 使用了<feOffset>元素。要实现此效果, 请拍摄SVG图形并将其在x-y平面中移动一点。

例子

<!DOCTYPE html>
<html>
<body>


<svg height="250" width="250">
  <defs>
    <filter id="p1" x="0" y="0" width="200%" height="200%">
      <feOffset result="offOut" in="SourceGraphic" dx="20" dy="20" />
      <feGaussianBlur result="blurOut" in="offOut" stdDeviation="10" />
      <feBlend in="SourceGraphic" in2="blurOut" mode="normal" />
    </filter>
  </defs>
  <rect width="90" height="90" stroke="blue" stroke-width="3" fill="purple" filter="url(#p1)" />
  </svg>

</body>
</html>

立即测试

解释

  • <filter>的id属性定义了模式的唯一名称。
  • <rect>元素的filter属性用于将元素链接到” p1″过滤器。
微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_46647.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?