0

i want to set Trianglify js for a SVG background but i can't. i can set for a div with the following codes :

        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());

1 Answers1

0

Edit: If you want to generate a trianglify design to use as your SVG background, you can use their Trianglify Generator. You can customize the pattern/design you want and then export to SVG or PNG.


Here's some info from the Github docs.

And from their main site:

var pattern = Trianglify();

//SVG DOM node
pattern.svg();
adriennetacke
  • 1,726
  • 1
  • 14
  • 21