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

Method burst

js/script.js:1760–2046  ·  view source on GitHub ↗

* 在指定位置爆炸 * @param {*} x * @param {*} y

(x, y)

Source from the content-addressed store, hash-verified

1758 * @param {*} y
1759 */
1760 burst(x, y) {
1761 // Set burst speed so overall burst grows to set size. This specific formula was derived from testing, and is affected by simulated air drag.
1762 const speed = this.spreadSize / 96;
1763
1764 let color, onDeath, sparkFreq, sparkSpeed, sparkLife;
1765 let sparkLifeVariation = 0.25;
1766 // Some death effects, like crackle, play a sound, but should only be played once.
1767 //有些死亡效果,像爆裂声,播放声音,但应该只播放一次。
1768 let playedDeathSound = false;
1769
1770 if (this.crossette)
1771 onDeath = (star) => {
1772 if (!playedDeathSound) {
1773 soundManager.playSound("crackleSmall");
1774 playedDeathSound = true;
1775 }
1776 crossetteEffect(star);
1777 };
1778 if (this.crackle)
1779 onDeath = (star) => {
1780 if (!playedDeathSound) {
1781 soundManager.playSound("crackle");
1782 playedDeathSound = true;
1783 }
1784 crackleEffect(star);
1785 };
1786 if (this.floral) onDeath = floralEffect;
1787 if (this.fallingLeaves) onDeath = fallingLeavesEffect;
1788
1789 if (this.glitter === "light") {
1790 sparkFreq = 400;
1791 sparkSpeed = 0.3;
1792 sparkLife = 300;
1793 sparkLifeVariation = 2;
1794 } else if (this.glitter === "medium") {
1795 sparkFreq = 200;
1796 sparkSpeed = 0.44;
1797 sparkLife = 700;
1798 sparkLifeVariation = 2;
1799 } else if (this.glitter === "heavy") {
1800 sparkFreq = 80;
1801 sparkSpeed = 0.8;
1802 sparkLife = 1400;
1803 sparkLifeVariation = 2;
1804 } else if (this.glitter === "thick") {
1805 sparkFreq = 16;
1806 sparkSpeed = isHighQuality ? 1.65 : 1.5;
1807 sparkLife = 1400;
1808 sparkLifeVariation = 3;
1809 } else if (this.glitter === "streamer") {
1810 sparkFreq = 32;
1811 sparkSpeed = 1.05;
1812 sparkLife = 620;
1813 sparkLifeVariation = 2;
1814 } else if (this.glitter === "willow") {
1815 sparkFreq = 120;
1816 sparkSpeed = 0.34;
1817 sparkLife = 1400;

Callers 1

launchMethod · 0.95

Calls 7

crossetteEffectFunction · 0.85
crackleEffectFunction · 0.85
createParticleArcFunction · 0.85
createBurstFunction · 0.85
createWordBurstFunction · 0.85
randomWordFunction · 0.85
shellSizeSelectorFunction · 0.85

Tested by

no test coverage detected