mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-12 06:08:34 +00:00
add options param to initHydra
This commit is contained in:
parent
f74d1beb62
commit
c0f56be2a9
@ -1,13 +1,19 @@
|
||||
import { getDrawContext } from '@strudel.cycles/core';
|
||||
|
||||
export async function initHydra() {
|
||||
export async function initHydra(
|
||||
options = {
|
||||
src: 'https://unpkg.com/hydra-synth',
|
||||
detectAudio: false,
|
||||
},
|
||||
) {
|
||||
if (!document.getElementById('hydra-canvas')) {
|
||||
const { canvas: testCanvas } = getDrawContext();
|
||||
await import('https://unpkg.com/hydra-synth');
|
||||
const { src, ...opts } = options;
|
||||
await import(src);
|
||||
const hydraCanvas = testCanvas.cloneNode(true);
|
||||
hydraCanvas.id = 'hydra-canvas';
|
||||
testCanvas.after(hydraCanvas);
|
||||
new Hydra({ canvas: hydraCanvas, detectAudio: false });
|
||||
new Hydra(Object.assign({ canvas: hydraCanvas }, opts));
|
||||
s0.init({ src: testCanvas });
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user