是否可以通过一定的偏移量来偏移svg元素中的图案?
下面的示例使用嵌入在<g>
元素中的圆形图案,并具有x="70"
的偏移量。不幸的是,这个偏移值只会'剪切'元素的一部分,而不会移动填充图案。
html, body, svg {
margin: 0;
width: 100%;
height: 100%;
}
<svg class="gFlow" id="main" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern height="64" id="grid" patternunits="userSpaceOnUse" width="64">
<circle cx="32" cy="32" fill="orange" r="5"></circle>
</pattern>
</defs>
<rect fill="url(#grid)" height="100%" width="100%" x="70"></rect>
</svg>