Forums > Jitter

multiple inlet jitter object in javascript…(jit.lumakey in js)

January 24, 2009 | 10:56 pm

How does one express the different inputs in the matrixcalc() function?
This question came up as I tried to debug why my below patch isn’t working. Really, I don’t even really need multiple inlets, as I’m trying to use jit.lumakey in mode 1….

Here’s my patch and JS:

#P window setfont "Sans Serif" 9.;
#P window linecount 6;
#P comment 331 224 100 196617 Or , maybe the JS needs some fanciness in matrixcalc becuase lumakey has 2 inputs?;
#P window linecount 1;
#P comment 129 227 100 196617 ….this;
#P user jit.pwindow 330 160 82 62 0 1 0 0 1 0;
#P newex 329 132 148 196617 jit.lumakey @fade 0.1 @lum 0.;
#P newex 10 61 21 196617 t 1;
#P newex 14 82 52 196617 metro 20;
#P button 78 32 15 0;
#P newex 85 59 127 196617 loadmess read dishes.mov;
#P newex 86 86 63 196617 jit.qt.movie;
#P user jit.pwindow 130 160 82 62 0 1 0 0 1 0;
#P newex 129 136 191 196617 jit.lumakey @mode 1 @fade 0.1 @lum 0.;
#P user jit.pwindow 19 162 82 62 0 1 0 0 1 0;
#P newex 23 134 77 196617 js moviekey.js;
#P window linecount 2;
#P comment 17 230 100 196617 this should be the same as….;
#P connect 6 0 9 0;
#P connect 9 0 8 0;
#P connect 1 0 2 0;
#P connect 5 0 1 0;
#P connect 7 0 6 0;
#P connect 6 0 5 0;
#P connect 8 0 5 0;
#P connect 5 0 3 0;
#P connect 3 0 4 0;
#P connect 5 0 10 0;
#P connect 10 0 11 0;
#P window clipboard copycount 14;

/*save as moviekey.js and put in search path */

autowatch = 1;
editfontsize = 12;

var outmatrix = new JitterMatrix();
outmatrix.adapt=1;
var dummatrix = new JitterMatrix();
dummatrix.adapt=1;
var lumakey = new JitterObject("jit.lumakey");
lumakey.mode = 1;
lumakey.fade = 0.1;
lumakey.lum = 0;
var matrixname = "movmatrix";
var usethismatrix = "";

function jit_matrix(inname){
outmatrix.setinfo(inname);
lumakey.matrixcalc(inname,outmatrix);
outlet(0,"jit_matrix",outmatrix.name);
}


January 25, 2009 | 10:41 am

well, I’m not 100% sure on this, but you should be able to send array
of matrix names as input to matrixcalc:

lumakey.matrixcalc( [inname, in2name] , outputmatrix);

hth,
nesa


January 25, 2009 | 4:41 pm

yes, that helps. thanks for the clue. for the record, here’s a script that works:

autowatch = 1;
editfontsize = 12;

var outmatrix = new JitterMatrix(4,"char",320,240);
outmatrix.adapt=1;
var dummatrix = new JitterMatrix(4,"char",320,240);
dummatrix.adapt=1;
var lumakey = new JitterObject("jit.lumakey");
lumakey.mode = 1;
lumakey.fade = 0.1;
lumakey.lum = 0;
lumakey.adapt = 1;
var matrixname = "movmatrix";
var usethismatrix = "";

function jit_matrix(inname){
outmatrix.setinfo(inname);
dummatrix.setinfo(inname);
lumakey.matrixcalc([inname,dummatrix],outmatrix);
outlet(0,"jit_matrix",outmatrix.name);
}


Viewing 3 posts - 1 through 3 (of 3 total)