This will not work, because the for loop will immediately start until the end, setTimeouts will be scheduled at the same time, and all functions will fire at the same time.
Instead, do the following:
var i = 1; (function loop(){ if(i++ > 200) return; setTimeout(function(){ drawPoint(vis,i,i); loop() }, 1000) })();
Explanation:
This IIFE will be launched for the first time with i = 1 . Then if increments i ( i++ execution) and checks if it is greater than 200. If so, the loop function is returned. If it is not, a setTimeout planned, which again calls drawnPoint and the loop function itself.
source share