Closed everythingability closed 4 years ago
@everythingability - why do you use p1
twice? The second time you either redefine/overwrite the original version of p1, or the JS engine should throw an error (since you can't redeclare a let-ted variable).
Oh yeah... Took that out and got this...
bundle.js:495 Uncaught TypeError: Cannot read property 'style' of null at EditorClass.show (bundle.js:495) at new EditorClass (bundle.js:451) at init (bundle.js:33)
It expects the Editor to be there?
UPDATE: Tom and I have gotten hydra working with p5 - https://github.com/MichaelPaulukonis/hydra-p5.git
However, there may be a bug with diff
that only works if makeGlobal: true
is set.
AFAICT we are prefixing everything properly - and it works when diff is commented-out and global is false.
But global false and diff and things are not happy.
Uncaught ReferenceError: src is not defined
at hydra-synth:2340
at Array.map (<anonymous>)
at formatArguments (hydra-synth:2256)
at hydra-synth:2166
at Array.forEach (<anonymous>)
at generateGlsl (hydra-synth:2165)
at generateGlsl (hydra-synth:2151)
at Object.GlslSource.compile (hydra-synth:2079)
at Object.GlslSource.glsl (hydra-synth:2072)
at Object.GlslSource.out (hydra-synth:2035)
We will open a separate issue when we know more.
BTW, p5.js is included by default in the hydra web editor. Here is an example:
p1 = new P5()
x = 100;
y = 100;
p1.draw = () => {
p1.clear();
p1.fill(255);
p1.rect(x,y,50,50);
}
p1.hide()
s0.init({src: p1.canvas})
src(s0)
.add(o0, 0.9)
.modulate(o0, 0.01)
.scale(1.01)
.hue(0.04)
.out()
The above code is using p5 in non-global mode, and hydra in global mode. p1 in this case is an instance of p5.
RE: using p5 with hydra-synth (not the web editor) There are some issues right now with non-global mode in hydra-synth that I am working on. In the meantime, you can try using an earlier version and it might work better.
I am going to close this issue but feel free to keep discussing! :)
Yeah.
Here's my attempt. https://hydra.ojack.xyz/?sketch_id=3dtNpzuYBAGdIz0J
The point though is maybe counter to Hydra's goals. I would like to craft "something" in p5js and then, say from the p5js Editor, add Hydra and have it run on my sketch. Is that possible? It's sort of the other way round...
tldr; No.
I am trying to do a VERY simple thing. I am out of my depth but loving Hydra.
I am trying to use an isolated p5 sketch as input for some Hydra code. All static on the page.
(Oh btw, did P5 get renamed as p5? Or am I missing something else?)
Here's my js file
My HTML is ...
I have added bundle.js to my index.html, but it is failing to require the Editor.js.
So my guess is that Hydra HAS to be running in Node, right?
Is there a way to do it the noddy way I am attempting?
Thanks