(width = 50)
| 137 | } |
| 138 | |
| 139 | export function generateBothEyes(width = 50) { |
| 140 | let rands_left = generateEyeParameters(width) |
| 141 | // Create a shallow copy of the object |
| 142 | let rands_right = { ...rands_left }; |
| 143 | |
| 144 | // Iterate over the object's keys |
| 145 | for (let key in rands_right) { |
| 146 | // Check if the property value is a number |
| 147 | if (typeof rands_right[key] === 'number') { |
| 148 | // Add a random value to the number, for example, between -5 and 5 |
| 149 | rands_right[key] += randomFromInterval(-rands_right[key] / 2.0, rands_right[key] / 2.0); |
| 150 | } |
| 151 | } |
| 152 | let left_eye = generateEyePoints(rands_left, width) |
| 153 | let right_eye = generateEyePoints(rands_right, width) |
| 154 | |
| 155 | for (let key in left_eye) { |
| 156 | if (typeof left_eye[key] === 'object') { |
| 157 | for (let i = 0; i < left_eye[key].length; i++) { |
| 158 | left_eye[key][i][0] = -left_eye[key][i][0] |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | return { left: left_eye, right: right_eye } |
| 163 | } |
nothing calls this directly
no test coverage detected