jit.gl.text2d and changing params

Apr 26, 2010 at 11:58am

jit.gl.text2d and changing params

Hi,
Because I want t be able to deform individual params for each character of a text string, I made the following script. However if I adjust my spacing parameter (to redefine xPosition) the drawing does not gets updated automatically and I need to feed my script the text again.

I’ve created an array with sufficient values to store all that I need for now, but when calling another who access one of the items in the array it does not get calculated.

Could someone explain?

——–javascript (text2D_js.js)————-

inlets=1;
outlets=2;
// create our window with a depth buffer and full scene anti aliasing (if supported)
//var window = new JitterObject(“jit.window”,”bobby”);
//window.depthbuffer = 1;
//window.fsaa = 1;
//
//// create our render object for our window
//var render = new JitterObject(“jit.gl.render”,”bobby”);

var newText=null;
// to do the spacing of the letters, 1 global variable is needed,

var spacing= 0.1;

function spacer(space){
spacing=space;
outlet(0,’spacer ‘+spacing);
for(i=0;i
newText[i].position[0]= newText[i].position[0]+spacing;
//outlet(0,newText[i].position[0]);
}
}

function text(val){
var xPos=-1.;
newText= new Array(val.length);
for(i=0;i
newText[i]= new JitterObject(“jit.gl.text2d”,”bobby”);
newText[i].text(val.charAt(i));
newText[i].size(24+i);
newText[i].color=[1,0,0,1];
newText[i].position=[0. + xPos,0,0];
//outlet(0,newText[i].position[0]);
xPos=xPos+spacing;
}
}

——– end of script ———-

Attachments:
  1. text2D_js.maxpat
#50007

You must be logged in to reply to this topic.