MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / createfrequency

Method createfrequency

assets/js/svg-generator.js:133–160  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

131 };
132
133 createfrequency(){
134 const root = this.root;
135 const fill = this.fill;
136 const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
137 path.setAttribute('fill', fill);
138 path.classList.add('path');
139 svg.appendChild(path);
140
141 // first & second points
142 let d = `M -${overflow} ${winH + overflow}`;
143 d += ` L ${root[0].x} ${root[0].y}`;
144
145 // Magic points
146 for (let i = 1; i < root.length - 1; i++) {
147 d += ` L ${root[i].x} ${root[i].y}`;
148 }
149
150 // Second last & last points
151 const reverseRoot = root.reverse();
152 d += ` L ${reverseRoot[0].x} ${reverseRoot[0].y}`;
153 d += ` L ${winW + overflow} ${winH + overflow}`;
154 root.reverse();
155
156 // Close path
157 d += ` Z`;
158
159 path.setAttribute('d', d);
160 };
161};
162
163

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected