Skip to content

Commit 3e2028c

Browse files
committed
fixed pattern parser
1 parent eaf9389 commit 3e2028c

6 files changed

Lines changed: 2036 additions & 1897 deletions

File tree

public/js/oscillaAnimationO2p.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
import { registerAnimation } from "./oscillaAnimation.js";
1919
import { scheduleCueStart } from "./oscillaCueDispatcher.js";
20+
import { createHitLabel, repositionAllHitLabels } from "./oscillaHitLabels.js";
21+
2022
import {
2123
applyPrestateBeforeStart,
2224
applyPrestateOnStart
@@ -875,6 +877,11 @@ export function handleO2PCue(el, args, options = {}) {
875877
rawStart();
876878
});
877879

880+
createHitLabel(el, "o2p", cfg.uid, {
881+
anchorMode: "followSizeMidPoint",
882+
color: "purple"
883+
});
884+
878885

879886
// -----------------------------------------------------------
880887
// AUTO-START (tdelay / start:N)

public/js/oscillaAnimationRotate.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ export function handleRotateSequence(el, cfg) {
374374
duration: stepDur * 1000,
375375
easing: ease,
376376
update: () => {
377-
repositionAllHitLabels();
377+
repositionAllHitLabels();
378378

379379
let a = ((driver.a % 360) + 360) % 360;
380380
el.style.transform = `rotate(${a}deg)`;
@@ -429,7 +429,7 @@ export function handleRotateContinuous(el, cfg) {
429429
if (key === "loop") loop = Number(value);
430430
if (key === "ease") ease = String(value).trim();
431431
if (key === "mode") mode = String(value).trim().toLowerCase();
432-
if (key === "osc") oscMode = Number(value) || 0;
432+
if (key === "osc") oscMode = Number(value) || 0;
433433
}
434434

435435
// stop existing animation if active
@@ -449,7 +449,7 @@ export function handleRotateContinuous(el, cfg) {
449449

450450
// glue hit-circles to object while rotating
451451
update: () => {
452-
try { repositionAllHitLabels(); } catch (e) {}
452+
try { repositionAllHitLabels(); } catch (e) { }
453453
}
454454
});
455455

@@ -655,11 +655,13 @@ export function handleRotateCue(el, astArgs, options = {}) {
655655
const start = wrapStart(cfg, rawStart);
656656

657657
// install ghost toggle
658-
installGhostToggle(cfg, rawStart);
658+
// installGhostToggle(cfg, rawStart);
659659

660660
registerAnimation(el, "rotate-sequence", cfg, start);
661-
// createHitLabel(el, "rotate", cfg.uid); // for rotate cue
662-
661+
createHitLabel(el, "rotate", cfg.uid, {
662+
anchorMode: "pathStart",
663+
color: "red"
664+
});
663665
if (shouldStartNow) start();
664666
return;
665667
}
@@ -685,8 +687,10 @@ export function handleRotateCue(el, astArgs, options = {}) {
685687
installGhostToggle(cfg, rawStart);
686688

687689
registerAnimation(el, "rotate-sequence", cfg, start);
688-
// createHitLabel(el, "rotate", cfg.uid); // for rotate cue
689-
690+
createHitLabel(el, "rotate", cfg.uid, {
691+
anchorMode: "pathStart",
692+
color: "red"
693+
});
690694
if (shouldStartNow) start();
691695
return;
692696
}
@@ -709,7 +713,10 @@ export function handleRotateCue(el, astArgs, options = {}) {
709713
registerAnimation(el, "rotate-fallback", cfg, start);
710714

711715

712-
createHitLabel(el, "rotate", cfg.uid);
716+
createHitLabel(el, "rotate", cfg.uid, {
717+
anchorMode: "pathStart",
718+
color: "red"
719+
});
713720

714721
if (shouldStartNow) start();
715722
}

public/js/oscillaAnimationScale.js

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// scale.js — OscillaScore Scale Cue (uniform & non-uniform)
22

33
import { registerAnimation } from "./oscillaAnimation.js";
4-
import { scheduleCueStart} from "./oscillaCueDispatcher.js";
4+
import { scheduleCueStart } from "./oscillaCueDispatcher.js";
5+
import { createHitLabel, repositionAllHitLabels } from "./oscillaHitLabels.js";
56

67
import {
7-
applyPrestateBeforeStart,
8-
applyPrestateOnStart
8+
applyPrestateBeforeStart,
9+
applyPrestateOnStart
910
} from "./oscillaAnimationShared.js";
1011

1112
// ============================================================
@@ -292,7 +293,7 @@ export function handleScaleSequence(el, cfg) {
292293
mode = String(val).trim().toLowerCase();
293294
if (mode === "alt") mode = "alternate"; // ← alias support restored
294295
break;
295-
}
296+
}
296297
case "pauseOnExit": pauseOnExit = Boolean(val); break;
297298
case "interp": interp = String(val).trim().toLowerCase(); break;
298299
case "ease": ease = String(val).trim(); break;
@@ -587,7 +588,7 @@ export function handleScaleCue(ast, el, options = {}) {
587588
if (key === "uid") uid = String(val).trim();
588589
if (key === "trig") trig = String(val).toLowerCase();
589590
if (key === "tdelay") cfgStartDelay = Number(val) || 0;
590-
if (key === "prestate") prestate = val;
591+
if (key === "prestate") prestate = val;
591592
}
592593

593594
console.log("[scaleCue] Parsed →", {
@@ -637,9 +638,9 @@ export function handleScaleCue(ast, el, options = {}) {
637638
function applyInitialScale(cfg) {
638639
try {
639640
const sx = cfg.xValues ? cfg.xValues[0] :
640-
cfg.values ? cfg.values[0] : 1;
641+
cfg.values ? cfg.values[0] : 1;
641642
const sy = cfg.yValues ? cfg.yValues[0] :
642-
cfg.values ? cfg.values[0] : sx;
643+
cfg.values ? cfg.values[0] : sx;
643644
el.style.transform = `scale(${sx}, ${sy})`;
644645
} catch (e) {
645646
console.warn("[scaleCue] Could not apply initial scale:", e);
@@ -690,6 +691,11 @@ export function handleScaleCue(ast, el, options = {}) {
690691
);
691692

692693
registerAnimation(el, "scale-sequence-pattern", cfg, start);
694+
createHitLabel(el, "scale", cfg.uid, {
695+
anchorMode: "midpoint",
696+
color: "lime"
697+
});
698+
693699
if (shouldStartNow) start();
694700
return;
695701
}
@@ -709,6 +715,11 @@ export function handleScaleCue(ast, el, options = {}) {
709715
);
710716

711717
registerAnimation(el, "scale-sequence-uniform", cfg, start);
718+
createHitLabel(el, "scale", cfg.uid, {
719+
anchorMode: "midpoint",
720+
color: "lime"
721+
});
722+
712723
if (shouldStartNow) start();
713724
return;
714725
}
@@ -739,6 +750,11 @@ export function handleScaleCue(ast, el, options = {}) {
739750
);
740751

741752
registerAnimation(el, "scale-sequence-xy", cfg, start);
753+
createHitLabel(el, "scale", cfg.uid, {
754+
anchorMode: "midpoint",
755+
color: "lime"
756+
});
757+
742758
if (shouldStartNow) start();
743759
return;
744760
}
@@ -764,6 +780,11 @@ export function handleScaleCue(ast, el, options = {}) {
764780
);
765781

766782
registerAnimation(el, "scale-continuous", cfg, start);
783+
createHitLabel(el, "scale", cfg.uid, {
784+
anchorMode: "midpoint",
785+
color: "lime"
786+
});
787+
767788
if (shouldStartNow) start();
768789
return;
769790
}
@@ -781,6 +802,11 @@ export function handleScaleCue(ast, el, options = {}) {
781802
);
782803

783804
registerAnimation(el, "scale-continuous", cfg, start);
805+
createHitLabel(el, "scale", cfg.uid, {
806+
anchorMode: "midpoint",
807+
color: "lime"
808+
});
809+
784810
if (shouldStartNow) start();
785811
}
786812

0 commit comments

Comments
 (0)