/** * danmaku.js — NicoNico/弾幕-style flying comments for v0ck * * Usage: * const d = new Danmaku(playerEl, videoEl); * d.load(commentsArray); // feed comments from API * d.fire('hello!', 'user', '#f0f'); // fire one immediately * d.toggle(); // toggle on/off * d.destroy(); // cleanup */ (function () { const PILL_MIN_MS = 6000; // Fastest a pill can cross the screen const PILL_MAX_MS = 12000; // Slowest a pill can cross the screen const LANE_COUNT = 10; // Vertical lane slots const LOOKAHEAD_SEC = 0.25; // How far ahead of currentTime we look when scanning const MIN_RANDOM_SECS = 2; // Random timecode lower bound (avoid very start) const RANDOM_SPREAD = 0.85; // Use 85% of duration for random spread /** * SyntheticClock — emulates a