There are various ways to animate random dot patterns, varying in how long each dot lives and the behaviour of the incoherent dots. This implementation uses a pattern where dots never die and all dots move with a constant speed. The coherent dots differ only in having a consistent direction. (Other versions are easy to implement too).