<svg viewBox="0 0 1000 400" width='1000' height='400' style='border:1px solid black'>
<defs>
<linearGradient id='b'>
<stop offset='20%' stop-color='green'></stop>
<stop offset='40%' stop-color='blue'></stop>
<stop offset='60%' stop-color='red'></stop>
<stop offset='80%' stop-color='yellow'></stop>
<stop offset='100%' stop-color='tomato'></stop>
</linearGradient>
</defs>
<defs>
<pattern id="a" x='10' y='10' width="40" height="40" patternUnits="userSpaceOnUse">
<circle r="15" cx="10" cy="10" fill="url(#b)" stroke="" stroke-width=""/>
</pattern>
</defs>
<rect x="0" y="0" width="200" height="200" fill="url(#a)" stroke="black" stroke-width="2"/>
</svg>
想象一下,图案是一块瓷砖,你将把它放在一定大小的墙上。此处和此处的理论 在您的示例中,正方形(墙)尺寸
200 х 200 px为 ,因此对于40 x 40 px图案尺寸(一个瓷砖),将有 5 个瓷砖宽和 5 行高。图案内的一切,再次与瓷砖类比,就是它的图案,超出瓷砖边界的东西将被切断。
为了更容易计算圆心的位置及其半径,请将其放在图案的中心。
我选择了半径而
18px不是20px允许1px边缘周围的间隙。一瓦
在 200 x 200px 正方形中多次放置图案的示例
半径示例(如问题所示)
15px图案动画示例
使用点阵图案和蒙版动画
使用旋转和颜色变化的 SMIL 动画
更复杂、复杂的图案动画