jitter matrix input to javascript

ćwiek's icon

hi
i am getting into javascript, but its quite hard for me, without any programming background.. can someone help me, with getting values, from one plane, float matrix, with fixed dimension?
thanks tor help
joł

hems's icon

unfortunately i don't know much about jit.matrix... i would guess it will come as an array to javascript, than you will have to do a "for" loop in your script to go through all cells..

if you post a simple example patch, with a jit matrix being filled and than dumped out, would be super easy to help ( :

might be from your interested this simple javascript example i put in this topic, and surely would help you to understand some stuff in javascript: https://cycling74.com/forums/extracting-the-state-of-a-toggle-in-javascript

good luck in your programming journey !

Tobias Rosenberger's icon

i am trying to learn some javascript and want to understand how to get a jitter-matrix input into js-code. As an example in the Jitter tutorial 46: In the attached JS-File there is a jit.noise object generated for the attractors.

// create a [jit.noise] object for attractor generation
var attgen = new JitterObject("jit.noise");
attgen.dim = ATTRACTOR_COUNT;
attgen.planecount = 3;
attgen.type = "float32";

if I don't want random attractor points, but generate a 3plane float32 matrix in Jitter, how can I then feed this jitter-generated-matrix into the JS-File and replace the jit.noise with it?

Rob Ramirez's icon

create a named jitter matrix in your patch:
[ jit.matrix mymatrix 4 char 80 60 ]

reference it in js:var mat = new JitterMatrix("mymatrix");

Zoy's icon

Hi,
I'm very new to Javascript and have the exactly same question as you Tobias ; have you the solution for this specific patch ?