I'm trying to recreate this background animation but instead of the random triangles that are drawn using javascript, I want to use three different SVG files.
I tried to replicate the function through this SO article, but couldn't quite get it right.
So my main question is, how and where would I need to manipulate the script to draw SVG's instead of the triangles it's doing now. Or if it's even possible?
My guess would be that it has to do with this part of the script but I'm not 100% sure:
this.draw = function() {
if(_this.alpha >= 0.005) _this.alpha -= 0.005;
else _this.alpha = 0;
ctx.beginPath();
ctx.moveTo(_this.coords[0].x+_this.pos.x, _this.coords[0].y+_this.pos.y);
ctx.lineTo(_this.coords[1].x+_this.pos.x, _this.coords[1].y+_this.pos.y);
ctx.lineTo(_this.coords[2].x+_this.pos.x, _this.coords[2].y+_this.pos.y);
ctx.closePath();
ctx.fillStyle = 'rgba('+_this.color+','+ _this.alpha+')';
ctx.fill();
};
Thanks in advance for any help and let me know if I need to clarify the issue a little more.