Animation of graph coloring in Javascript