I've written a simple image slider using HTML5 canvas. After each image reaches end of screen it is removed from the array which is causing random image flickering. How can i fix this.
JSFiddle : http://jsfiddle.net/mbe5R/2/
this.animate = function() {
        this.y += this.speed;
        this.x = this.xrandom * albumWall.canvas.width - 250;
            if(this.y > innerHeight) {
                    albumWall.fbImages.splice(albumWall.fbImages.indexOf(this),1);
                    if(albumWall.count==(albumWall.imgArr.length-1)) {
                        albumWall.count=-1;
                    }else{
                        albumWall.count++;
                        var img = albumWall.imgArr[albumWall.count];
                        console.log(img)
                        albumWall.fbImages.push(new self.fbImage(albumWall.count, img, img.width, img.height));
                    }
                }
            };
When the image reaches the end of window i'm removing it
albumWall.fbImages.splice(albumWall.fbImages.indexOf(this),1);
I think this is causing the problem for the screen to flicker randomly.
 
     
     
    