(start, arcLength, count, randomness, particleFactory)
| 1483 | // Helper used to semi-randomly spread particles over an arc |
| 1484 | // Values are flexible - `start` and `arcLength` can be negative, and `randomness` is simply a multiplier for random addition. |
| 1485 | function createParticleArc(start, arcLength, count, randomness, particleFactory) { |
| 1486 | const angleDelta = arcLength / count; |
| 1487 | // Sometimes there is an extra particle at the end, too close to the start. Subtracting half the angleDelta ensures that is skipped. |
| 1488 | // Would be nice to fix this a better way. |
| 1489 | const end = start + arcLength - angleDelta * 0.5; |
| 1490 | |
| 1491 | if (end > start) { |
| 1492 | // Optimization: `angle=angle+angleDelta` vs. angle+=angleDelta |
| 1493 | // V8 deoptimises with let compound assignment |
| 1494 | for (let angle = start; angle < end; angle = angle + angleDelta) { |
| 1495 | particleFactory(angle + Math.random() * angleDelta * randomness); |
| 1496 | } |
| 1497 | } else { |
| 1498 | for (let angle = start; angle > end; angle = angle + angleDelta) { |
| 1499 | particleFactory(angle + Math.random() * angleDelta * randomness); |
| 1500 | } |
| 1501 | } |
| 1502 | } |
| 1503 | |
| 1504 | //获取字体点阵信息 |
| 1505 | function getWordDots(word) { |
no outgoing calls
no test coverage detected