mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-27 21:48:27 +00:00
enable hydra options update
This commit is contained in:
parent
66fd20ace5
commit
ebc6723f55
@ -1,6 +1,10 @@
|
|||||||
import { getDrawContext } from '@strudel.cycles/core';
|
import { getDrawContext } from '@strudel.cycles/core';
|
||||||
|
|
||||||
|
let options = ""
|
||||||
|
|
||||||
export async function initHydra(config) {
|
export async function initHydra(config) {
|
||||||
|
|
||||||
|
//load and init hydra
|
||||||
if (!document.getElementById('hydra-canvas')) {
|
if (!document.getElementById('hydra-canvas')) {
|
||||||
const { canvas: testCanvas } = getDrawContext();
|
const { canvas: testCanvas } = getDrawContext();
|
||||||
await import('https://unpkg.com/hydra-synth');
|
await import('https://unpkg.com/hydra-synth');
|
||||||
@ -10,6 +14,17 @@ export async function initHydra(config) {
|
|||||||
h.canvas.style.top = '0px';
|
h.canvas.style.top = '0px';
|
||||||
testCanvas.after(h.canvas);
|
testCanvas.after(h.canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update options
|
||||||
|
if (options != JSON.stringify(config)) {
|
||||||
|
options = JSON.stringify(config);
|
||||||
|
|
||||||
|
new Hydra(
|
||||||
|
{
|
||||||
|
canvas: document.getElementById('hydra-canvas'),
|
||||||
|
detectAudio: config?.audio
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const H = (p) => () => p.queryArc(getTime(), getTime())[0].value;
|
export const H = (p) => () => p.queryArc(getTime(), getTime())[0].value;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user