How could you make an animated image?

Im trying make one sprite to another if for example the screen is touched on the left side and another sprite when screen is touched on the right side.

Could someone send me a link to some help page or give help directly in the comment section.
I tried to make a table with sprites but the sprite() didn’t like it.

A table works best, eg

function setup()
    sprites={"Documents:image1","Documents:image2","Documents:image3"}
    s=1
end

function draw()
    background(0)
    sprite(sprites[s],300,300)
end

function touched()
    if t.state==ENDED then
        s=s+1 --rotate through sprites
        if s>#sprites then s=1 end 
    end
end