![]() But, they all seem to resolve instantly (?) as I see the path show as soon as I click the "animate" button const shortestPathAndScanningOrder = dijkstras(grid) My expectation was that numOfAnimationsForPath number of promises would be set and trigger a change in the appearance of the board when each one resolved (forming the appearance of a path). ![]() I also tried to set a series of promises set to resolve after setTimeout(resolve, milliseconds) occurs, where the milliseconds steadily increases (see below code). I've found lots of ways to freeze the browser. JavaScript really isn't designed to allow someone to delay code execution in the browser. Īfter doing some research on both setTimeout, promises and other options, I can tell you: I also plan to add a CSS animation with color or something.īasically the user ends up seeing something like this, where * is the start node, x is the end node, and + indicates the path. The animation, which is just changing text in a series of divs, should take a few seconds. I intend to animate both the "scanning" of the nodes by the pathfinding algorithm and the shortest path from the start node to the end node. My current goal is to slowly change the appearance of the text on the user-facing board, character by character, until the "animation" is finished. The ASCII art displays a n by m size board with n*m number of nodes on it. I have an ASCII art "pathfinding visualizer" which I am modeling off of a popular one seen here.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |