用带偏移量的背景图像填充SVG元素 [英] Fill SVG element with with a background-image with an offset

查看:90
本文介绍了用带偏移量的背景图像填充SVG元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做类似这样的填充SVG路径元素一个背景图像



但是,我想要移动/偏移图像。使用CSS,可以通过设置 background-image background-position 轻松完成。您可以使用 patternTransform >如何使用SVG执行此操作?

对图案元素进行图案变换;它的作用就像您可能已经熟悉的 transform 属性。有关详细信息,请参阅文档


I want to do something similar to this Fill SVG path element with a background-image

However, I want to shift/offset the image. With CSS, it can easily done by setting background-image and background-position. How do I do it with SVG?

解决方案

You can use patternTransform on the pattern element to transform the pattern; it works just like the transform attribute you may already be familiar with. See the documentation for details.

这篇关于用带偏移量的背景图像填充SVG元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆