MCPcopy Create free account
hub / github.com/NianBroken/Firework_Simulator / createParticleArc

Function createParticleArc

js/script.js:1485–1502  ·  view source on GitHub ↗
(start, arcLength, count, randomness, particleFactory)

Source from the content-addressed store, hash-verified

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.
1485function 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//获取字体点阵信息
1505function getWordDots(word) {

Callers 3

crossetteEffectFunction · 0.85
crackleEffectFunction · 0.85
burstMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected