random color letter with mgraphics

    Oct 25 2012 | 1:15 pm
    I'm trying to write a string with random color for each letter is anyone know how to do this with jsui?
    here's my code first test,the problem is that between each letter the "pencil" go to up/left corner... i could write "move_to(x,y)" but i don't know the width of the precedent letter...
    ************************************************************* mgraphics.init(); mgraphics.relative_coords = 1; //mgraphics.autofill = 0;
    var stringA = new Array(); var strCl = new String ("boby"); mgraphics.redraw();
    function bang(){ mgraphics.redraw(); }
    function paint(){ mgraphics.move_to(-0.8, 0.5); mgraphics.set_font_size(60);
    for (e = 0; e < strCl.length; e++) { with(mgraphics){ set_source_rgb(Math.random(),Math.random(),Math.random()); text_path(strCl.charAt(e)); fill(); } }

    • Oct 26 2012 | 8:26 am
      up :)
    • Oct 26 2012 | 10:13 am
      If you look in here:
      You will find all of the mgraphics Patch-a-day stuff. On November 30th, I did a routine that did text justification, and I used the "text_measure" routine to determine where things were at. That patch/javascript combo will probably give you enough information to do what you want.
    • Oct 26 2012 | 3:21 pm
      thanks a lot Darwin, I haven't noticed " text_measure"... that is what i need your patch a day serie was great!!