{
const svg = d3.create("svg")
.attr("width",255)
.attr("height",255);
const triangulos = [];
let x = 5;
let y = 1;
const interlineado = 16;
const cantidad = 16;
while(y < 256){
while(x < 256){
let p1 = `${x + 5}, ${y + 10}`;
let p2 = `${x}, ${y}`;
let p3 = `${x + 10}, ${y}`;
let puntos = `${p1} ${p2} ${p3}`;
triangulos.push({points:puntos, fill:'#ffffff', stroke:'#ff0000'})
x += interlineado;
}
x = 5;
y += interlineado;
}
x = -3;
y = 1;
while(y < 256){
while(x < 256){
let p1 = `${x + 5}, ${y}`;
let p2 = `${x}, ${y + 10}`;
let p3 = `${x + 10}, ${y + 10}`;
let puntos = `${p1} ${p2} ${p3}`;
triangulos.push({points:puntos, fill:'#ffff00', stroke:'#0000ff'})
x += interlineado;
}
x = -3;
y += interlineado;
}
var triangulo = svg.selectAll("polygon")
.data(triangulos)
.enter()
.append("polygon");
triangulo.attr("points", function(d) {return d.points;} )
.style("fill", function(d) {return d.fill;} )
.style("stroke" , function(d) {return d.stroke;} )
.style("stroke-width", 1);
return svg.node();
}