()
| 877 | |
| 878 | // 获取随机的烟花尺寸 |
| 879 | function getRandomShellSize() { |
| 880 | const baseSize = shellSizeSelector(); |
| 881 | const maxVariance = Math.min(2.5, baseSize); |
| 882 | const variance = Math.random() * maxVariance; |
| 883 | const size = baseSize - variance; |
| 884 | const height = maxVariance === 0 ? Math.random() : 1 - variance / maxVariance; |
| 885 | const centerOffset = Math.random() * (1 - height * 0.65) * 0.5; |
| 886 | const x = Math.random() < 0.5 ? 0.5 - centerOffset : 0.5 + centerOffset; |
| 887 | return { |
| 888 | size, |
| 889 | x: fitShellPositionInBoundsH(x), |
| 890 | height: fitShellPositionInBoundsV(height), |
| 891 | }; |
| 892 | } |
| 893 | |
| 894 | // Launches a shell from a user pointer event, based on state.config |
| 895 | function launchShellFromConfig(event) { |
no test coverage detected