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

Function seqPyramid

js/script.js:978–1016  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

976}
977
978function seqPyramid() {
979 const barrageCountHalf = IS_DESKTOP ? 7 : 4;
980 const largeSize = shellSizeSelector();
981 const smallSize = Math.max(0, largeSize - 3);
982 const randomMainShell = Math.random() < 0.78 ? crysanthemumShell : ringShell;
983 const randomSpecialShell = randomShell;
984
985 function launchShell(x, useSpecial) {
986 const isRandom = shellNameSelector() === "Random";
987 let shellType = isRandom ? (useSpecial ? randomSpecialShell : randomMainShell) : shellTypes[shellNameSelector()];
988 const shell = new Shell(shellType(useSpecial ? largeSize : smallSize));
989 const height = x <= 0.5 ? x / 0.5 : (1 - x) / 0.5;
990 shell.launch(x, useSpecial ? 0.75 : height * 0.42);
991 }
992
993 let count = 0;
994 let delay = 0;
995 while (count <= barrageCountHalf) {
996 if (count === barrageCountHalf) {
997 setTimeout(() => {
998 launchShell(0.5, true);
999 }, delay);
1000 } else {
1001 const offset = (count / barrageCountHalf) * 0.5;
1002 const delayOffset = Math.random() * 30 + 30;
1003 setTimeout(() => {
1004 launchShell(offset, false);
1005 }, delay);
1006 setTimeout(() => {
1007 launchShell(1 - offset, false);
1008 }, delay + delayOffset);
1009 }
1010
1011 count++;
1012 delay += 200;
1013 }
1014
1015 return 3400 + barrageCountHalf * 250;
1016}
1017
1018function seqSmallBarrage() {
1019 seqSmallBarrage.lastCalled = Date.now();

Callers 1

startSequenceFunction · 0.85

Calls 2

shellSizeSelectorFunction · 0.85
launchShellFunction · 0.85

Tested by

no test coverage detected