35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
import { g as r, Q as f, R as g, S as m, T as i } from "./index-Bvzuq3Qo.js";
|
|
let t, a;
|
|
async function p(e = {}) {
|
|
if (t && JSON.stringify(t) !== JSON.stringify(e) && document.getElementById("hydra-canvas")?.remove(), t = e, !document.getElementById("hydra-canvas")) {
|
|
const {
|
|
src: c = "https://unpkg.com/hydra-synth",
|
|
feedStrudel: d = !1,
|
|
contextType: l = "webgl",
|
|
pixelRatio: y = 1,
|
|
pixelated: o = !0,
|
|
...s
|
|
} = {
|
|
detectAudio: !1,
|
|
...e
|
|
}, { canvas: h } = r("hydra-canvas", { contextType: l, pixelRatio: y, pixelated: o });
|
|
if (s.canvas = h, await import(
|
|
/* @vite-ignore */
|
|
c
|
|
), a = new Hydra(s), d) {
|
|
const { canvas: n } = r();
|
|
n.style.display = "none", a.synth.s0.init({ src: n });
|
|
}
|
|
}
|
|
return a;
|
|
}
|
|
function v() {
|
|
a && a.hush(), globalThis.s0?.clear(), document.getElementById("hydra-canvas")?.remove(), globalThis.speed = f, globalThis.shape = g;
|
|
}
|
|
const T = (e) => () => m(e).queryArc(i(), i())[0].value;
|
|
export {
|
|
T as H,
|
|
v as clearHydra,
|
|
p as initHydra
|
|
};
|