In my turtle graphics app "tgsjhs" I am currently unable to achieve any
smooth animation of turtle moves. I have had and extensive conversation on
stackoverflow.com at the following link, and it looks as if I am incapable
of using the javascript/jquery side to accomplish the desired animation, so
I am looking for ideas here for accomplishing the desired animation in J
and its interaction via JS scripts.

http://stackoverflow.com/questions/23313863/apply-setinterval-to-what-function/23326041#23326041

At present, the relevant j code is as follows. NUMBER contains the number
of (animation) steps that turtle(s) have already undertaken from the
beginning of the simulation. Each time a "command" is "entered" in the
system, NUMBER is incremented as many times as needed according to the
various turtle movements, and each such movement is added to the list named
PENDING. So PENDING is a list containing NUMBER number of items which at
present are all processed without delay by the webgl code each time a
"command" is entered. My goal is to force a short delay between each of
those items being processed by inserting a delay using 6!:3.

I may not have provide enough information, but can I get some help in how
to accomplish this? I especially don't know how to write more javascript
and maybe more j to break this process up into more steps.

(Actually it would be better still if a hybrid of this definition were
possible: if the *existing* list items were executed at once as they
currently are, and only the newest additions to NUMBER in the list group
were animated. But that is extra credit. You see, each "command" may
increment NUMBER and PENDING more than once.)

ev_command_enter=: 3 : 0
PENDING=: ''
NUMBER=: 0
". getv 'command'
jhrajax (":NUMBER),JASEP,viewXYZ,JASEP,viewUP,JASEP,}.PENDING
)

And at present the pieces of JS in the app are as follows.

function ev_command_enter(){jdoajax(["command"],"");}

function ev_command_enter_ajax(elements)
{
    var number = elements[0];
    viewXYZ = elements[1];
    viewUP  = elements[2];
    for(var r = 0; r < number; r++) {
var ts = [];
for(var i = 0; i < 13; i++) {
    element = r*13+i+3;
    ts.push(elements[element]);
}
linecolor=eval(ts[0]);
linecolors = linecolors.concat(linecolor);
move=eval(ts[1]);
moves = moves.concat(move);
leftColors=eval(ts[2]);
rightColors=eval(ts[3]);
backColors=eval(ts[4]);
bottoms=eval(ts[5]);
lefts=eval(ts[6]);
rights=eval(ts[7]);
backs=eval(ts[8]);
bottomNs=eval(ts[9]);
leftNs=eval(ts[10]);
rightNs=eval(ts[11]);
backNs=eval(ts[12]);
draw();
   }
}

Thanks,

-- 
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to