text3d in JS?


    Apr 12 2006 | 8:26 am
    Dear List, Dear Josh:
    I am trying to get text controlled in JS and seem not to be able to get
    the .text = "ugh" assignment to work: Is there something I am missing
    here? It works fine in the patcher!
    Greetings and Thanks, Greg
    // PATCH PARAMETERS
    ------------------------------------------------------------
    autowatch = 1;
    inlets = 1;
    outlets = 5;
    var start_point = 0.0;
    var advance = -6.5;
    var scorewindow = new JitterObject("jit.window","score");
    scorewindow.depthbuffer = 1;
    scorewindow.doublebuffer = 1;
    scorewindow.fsaa = 1;
    scorewindow.size = [800, 800];
    //scorewindow.ortho = 1;
    var drawMe = new JitterObject("jit.gl.sketch", "score");
    drawMe.automatic = 1;
    var drawMetoo = new JitterObject("jit.gl.sketch", "score");
    drawMetoo.automatic = 1;
    var drawText= new JitterObject("jit.gl.text2d", "score");
    drawText.automatic = 1;
    drawText.font = "Courier";
    drawText.text = "start";
    drawText.axes = 1;
    var render = new JitterObject("jit.gl.render", "score");
    function progress (){
    advance = advance+0.1;
    }
    function drawMovingDot(){
    drawMe.reset();
    start_point = Math.random(1.0);
    drawMe.moveto(advance, start_point);
    drawMe.glcolor(0.7, 0.7, 0.7);
    drawMe.circle(0.1);
    }
    function drawTrail(){
    start_point = Math.sin(Math.random(1.0));
    drawMetoo.moveto(advance, start_point);
    drawMetoo.glcolor(0.0, 0.0, 0.0);
    drawMetoo.circle(0.1);
    }
    function drawThisText(){
    start_point = Math.sin(Math.random(1.0));
    drawText.drawto = "score";
    drawText.align = "center";
    drawText.text = "why not?";
    drawText.position = [-1.0, 0.0, 0.0];
    drawText.color = [1.0, 1.0, 1.0, 1.0];
    drawText.depth = 0;
    drawText.lighting_enable = 1;
    drawText.size = 24;
    }
    function bang(){
    render.erase();
    drawThisText();
    drawMovingDot();
    drawTrail();
    render.drawclients();
    render.swap();
    }

    • Apr 12 2006 | 12:20 pm
      hi greg,
      some weeks ago i had the same problem. it seems as you can assign
      values only to attributes of an object, whereas for messages you have
      to call a method of the same name. here a short sniplet of my
      javascript, hope that helps:
      textObject.text("hello, this is leiwand!");
      textObject.font("Helvetica");
      textObject.blend_enable = 1;
      textObject.position = [-1.0, 0.0, 0.0];
      best
      chris