import constant from "./constant.js"; import ArrowOnPath from "./arrowonpath.js"; function getRandomColorRgb() { let red = Math.floor(Math.random() * 256); let green = Math.floor(Math.random() * 256); let blue = Math.floor(Math.random() * 256); return `rgb(${red}, ${green}, ${blue})`; } export default function () { console.log('ssksk'); var arrowParts = constant(3), arrowThickness = constant(5), arrowAngle = constant(2), arrowPadding = constant(1), output = null, circularSvg = d3.select("svg"), // Move out of here it doesnt belong circularPath = circularSvg.select("path").node(); console.log('ezteze'); function cyclicarrow(data) { console.log('blah'); var l = circularPath.getTotalLength(); var segs = 8; var seg_l = l / segs; console.log(l, seg_l) for (var i = 0; i < segs; i++) { var start = i * seg_l; var end = (i + 1) * seg_l; console.log(i, start, start); var ar = new ArrowOnPath(circularPath, start, end); circularSvg.append("path") .attr("d", ar.toString()) .attr("style", "fill:" + getRandomColorRgb()); } } cyclicarrow.arrowAngle = function (_) { return arguments.length ? (arrowAngle = typeof _ === "function" ? _ : constant(+_), cyclicarrow) : arrowAngle; }; return cyclicarrow; }