function animator(shapes, $timeout) {
    (function tick() {
        var i;
        var now = new Date().getTime();
        var maxX      = 600;
        var maxY      = 600;
        var now = new Date().getTime();
        $timeout(tick, 30);
    })(); // What is this for?
}
Here I don't understand the functionality. I am new to this kind of script. Inside of the main function is like ()(). What is this for?
 
     
     
     
     
     
    