フィルターまたは SVG のメソッドを使用して、パターンとグラデーションの両方を要素に適用する方法はありますか?
これを実現するために、重複した要素(任意の形状)を作成したくありません。メンテナンスのオーバーヘッドです。
以下の画像は、予想される出力のサンプルです。
<svg xmlns='http://www.w3.org/2000/svg' width='100%' height='100%'>
<defs>
<pattern id='tile' patternUnits='userSpaceOnUse' width='75' height='75' viewBox='0 0 50 50'>
<line x1='1' y1='0' x2='51' y2='50' stroke='#19203d' stroke-width='2'/>
<line x1='49' y1='0' x2='-1' y2='50' stroke='#19203d' stroke-width='2'/>
<line x1='50' y1='0' x2='0' y2='50' stroke='#313763' stroke-width='2'/>
<line x1='0' y1='0' x2='50' y2='50' stroke='#313763' stroke-width='2'/>
</pattern>
<radialGradient id='l' cx='50%' cy='200%' fy='0' r='201%'>
<stop offset='0%' style='stop-color:#fff; stop-opacity:.1;' />
<stop offset='10%' style='stop-color:#000; stop-opacity:0.1;' />
<stop offset='30%' style='stop-color:#000; stop-opacity:0.3;' />
<stop offset='90%' style='stop-color:#000; stop-opacity:0.55;' />
<stop offset='100%' style='stop-color:#000; stop-opacity:.6' />
</radialGradient>
</defs>
<rect fill='#39466b' width='100%' height='100%'/>
<rect fill='url(#tile)' width='100%' height='100%'/>
<rect width='100%' height='100%' fill='url(#l)'/></svg>
グラデーションとパターンを塗りつぶすための要素を複製したくありません。上記のコードには要素が重複しています。