Working out the algorithm for knight rider animation