MCPcopy Index your code
hub / github.com/processing/p5.js / _shapeList

Function _shapeList

src/accessibility/textOutput.js:97–125  ·  view source on GitHub ↗
(idT, ingredients)

Source from the content-addressed store, hash-verified

95
96 //Builds textOutput shape list
97 function _shapeList(idT, ingredients) {
98 let shapeList = '';
99 let shapeNumber = 0;
100 //goes trhough every shape type in ingredients
101 for (let x in ingredients) {
102 for (let y in ingredients[x]) {
103 //it creates a line in a list
104 let _line = `<li><a href="#${idT}shape${shapeNumber}">${
105 ingredients[x][y].color
106 } ${x}</a>`;
107 if (x === 'line') {
108 _line =
109 _line +
110 `, ${ingredients[x][y].pos}, ${
111 ingredients[x][y].length
112 } pixels long.</li>`;
113 } else {
114 _line = _line + `, at ${ingredients[x][y].pos}`;
115 if (x !== 'point') {
116 _line = _line + `, covering ${ingredients[x][y].area}% of the canvas`;
117 }
118 _line = _line + '.</li>';
119 }
120 shapeList = shapeList + _line;
121 shapeNumber++;
122 }
123 }
124 return { numShapes: shapeNumber, listShapes: shapeList };
125 }
126}
127
128export default textOutput;

Callers 1

textOutputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected