Q:

Move a canvas image back and forth using setInterval

I'm trying to get an image in a canvas to move back and forth using setInterval. I've been struggling find the solution with no avail. Can anyone figure out the problem?
Here's my code:
...
var img = new Image;
var url = ["sprite-right.png","sprite-left.png"];
var ctx2;

for (i=0; i<3; i++) {
    img.src = url[i];
}

img.onload = function() {
    start();
}

function start() {
    var canv2 = document.getElementById("canvas2");
    ctx2 = canv2.getContext("2d");
    var x = 50, y = 100;
    var direction = "right";
    var interval = setInterval(function() {
    if (direction == "right") {
        img.src=url[0];
        ctx2.clearRect(0, 0, ctx2.canvas.width, ctx2.canvas.height);
        ctx2.drawImage(img, x, y);
        x++;
        if (x>690) {
            direction = "left";
            } // end if
    } else if (direction == "left") {
        img.src=url[1];
        ctx2.clearRect(0, 0, ctx2.canvas.width, ctx2.canvas.height);
        ctx2.drawImage(img, x, y);
        x--;
        if (x<50) {
            direction = "right";
            } // end if
        } // end if
        },1); // end set interval
} // end function

A:

Your code is infinite-looping.
(Working plunkr)
Everytime your Image loads, it runs the 'start' function; however, that function changes the image url, so it loads again, which runs the 'start' function, etc.
I got your code running by making multiple Images instead of using just one; this way, the Image isn't constantly reloading.
Notable changes were the addition of the 'img2' variable and reordering the code; everything else was fine the way it was.
var img = new Image(),
img2 = new Image();
var url = ["https://www.google.com/images/srpr/logo11w.png","http://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Smiley.svg/220px-Smiley.svg.png"];
var ctx2;

function start() {
  console.log('whirrr');
    var canv2 = document.getElementById("canvas2");
    ctx2 = canv2.getContext("2d");
    var x = 50, y = 100;
    var direction = "right";
    var interval = setInterval(function() {
    if (direction == "right") {
        //img.src=url[0];
        ctx2.clearRect(0, 0, ctx2.canvas.width, ctx2.canvas.height);
        ctx2.drawImage(img, x, y);
        x++;
        if (x>690) {
            direction = "left";
            } // end if
    } else if (direction == "left") {
        //img.src=url[1];
        ctx2.clearRect(0, 0, ctx2.canvas.width, ctx2.canvas.height);
        ctx2.drawImage(img2, x, y);
        x--;
        if (x<50) {
            direction = "right";
            } // end if
        } // end if
        },1); // end set interval
} // end function

img.onload = function() {
    start();
}

//for (i=0; i<3; i++) {
//    img.src = url[i];
//}
img.src = url[0];
img2.src = url[1];

