我想为 SVG 背景设置 Trianglify js,但我不能。我可以使用以下代码为 div 设置:
var something = document.getElementById('portfolio');
var dimensions = something.getClientRects()[0];
var pattern = Trianglify({
width: dimensions.width,
height: dimensions.height,
x_colors: ['#444', '#555', '#666', '#777', '#888', '#999'],
y_colors: 'match_x',
});
something.appendChild(pattern.canvas());