Pausing JavaScript execution for animation of code -
I have an interesting but difficult problem with javascript code. In fact, I have JavaScript (a sorting algorithm for academic reasons, If you are thinking) trying to create a simple algorithm animation. I've got all the animation code (RaphaelJS) already used, and it all works fine. The animation is getting algorithm for being in the right time. Javascript is actually no way to "stop" execution, So I can not really move slowly through the algorithm, in every phase the animation runs. This is clearly more valuable than an educational perspective if the student makes algorithm revenue at a pace.
There are two ways to solve this problem, which I can think of, and both suck before using some crazy setTimeout () code it would probably be very difficult - odd code changes to correct time expiration Along with the different parts of the algorithm will need to be associated. I have already tried to do a little bit of it, and it becomes very complicated for a non-trivial algorithm.
The second is busy-wait this will probably work. The problem is that waiting is a very bad idea in the Javascript code - I was actually testing this option when I was actually crashing Firefox. I am thinking that here is another solution which I am seeing. Bonus points if the solution is only client-side, because due to the amount of freedom I have to serve things other than static HTML and javascript is suspected on the school server.
This is clearly more valuable than an educational perspective if the algorithm with no speed in the income tax The student can understand.
What about using links / buttons like this? > Allow user to take actions through code by clicking Previous / Next?
It may be that only viable solutions and more information for the end user.